Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help adding new data to a subform

Status
Not open for further replies.

ropewrench

Programmer
Joined
Feb 20, 2005
Messages
10
Location
US
I know I am missing something very simple in this but I am in need of help.
I have a form based on 2 tables. When the form opens it opens as acAdd. The main part of the form has a combo box where user selects an item. The subform is datasheet where the user is supposed to enter new data relevant to the item selected in the main form. Problem is multifold. First: When the item is selected the subform fills in the datasheet with records found relating to the item, instead of leaving it blank to accept new data. Then when I do enter data into the empty lines it saves that entry plus creates 2 other duplicates in the second table, which stores the record entries.
If there is already an answer to this problem in this forum, I apologize for repeating it.

Thank you in advance
ropewrench
 
How are ya ropewrench . . . . .

Sure sounds like a design problem . . .
[ol][li]Are the tables [blue]linked in a relationship[/blue] to each other?[/li]
[li]If the above is true, what are the l[blue]inking field names?[/blue][/li]
[li]Is the subform linked to the mainform in the [blue]Master/Child Link[/blue] properties, with the [blue]link fields above?[/blue][/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
TheAceMan1,
Thank you for the response.
I will try and give as much generic information as I can due to company restrictions.
1. Are the tables linked in a relationship to each other? Yes
2. 1:M relationship: tblOne.fldUnitNum to tblTWO.fldMaintUnitNum
3. Master; cboUnitNum to Child; fldMaintUnitNum
When entering the form from the menu before I have the settings of the main form to add as new. The properties of both main and subform are set to allow additions and Data Entry is set to No. I have tried setting it to Yes as well.


repectfully,
ropewrench
 
So, it sounds like in the main form, the users chooses a UnitNum from cboUnitNum, and the subform displays related records from another table? If this is how you have it set up, and don't want it like this, how would you like it? If there are related records in the child table, then they will display when you pick a UnitNum. Is it that you only want to be adding additional records to the child table and do not want to see any existing child records? If so, can you set ONLY the subform's DataEntry property to YES? Maybe we need to understand more what you are trying to do, and your tables' structures. Also form RecordSources (for both main and subforms) as well as combo box rowsource and controlsource. Do you have any code in the combo box events? Or in any of the subform or form events? Thanks.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I wanted to post a thanks for the help. The problem was a design flaw with the Master/Child link between the main form and subform. I needed to remove the links and redefine the relationships between the corrisponding tables. That was also the other problem, the main form did not need a referencing table, the fields were only for display.


respectfully,
ropewrench
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top