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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform based on record created in main form

Status
Not open for further replies.

badrack

Technical User
Jun 11, 2001
4
US
Hi,

I am trying to create a subform that is based on a record created in the main form. The problem is that when I am entering new data into the form it seems to open the subform first then the main form thereby not giving my subform a record to link to. The primary key for the main form is the item code while the primary link for the subform is the purchase order number entered in the main form. How do I get around this without making a new form that opens when you close the main form?

Thanks in advance.
 
By primary link do you mean primary key? If so that is not important. By primary link do you mean the 'Link Child Field' and 'Link Master Field' in the subform container? If so then how is the item code and purchase order number related? There does need to be a foreign key on the 'many' table that relates to the unique key on the 'one' table. Please clarify.

Steve King Growth follows a healthy professional curiosity
 
The for Master field and child field is the purchse order number but the main form fields are all based off a query which is linked by itemcode. I want this database to pull up part information based on the itemcode and have new information entered that is based off the current purchase order.
 
The query for the main form must have a relational link to the subform. Since you said that is the purchase order number then the purchase order number must be in the query and must be in the ControlSource for the subform. Then the Link Master Field is the purchase order number and the Link Child Field is the purchase order number and those to data sources both contain an identical value it should display.

RecordSource.qryMain (Property of the main form)
[Purchase Order Number]

Subform Container (On the main form)
Link Master Field = Purchase Order Number
Link Child Field = Purchase Order Number

RecordSource.Subform Table (Property of the subform)
[Purchase Order Number]

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top