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

update parent & subform records

Status
Not open for further replies.

tyleri

Programmer
Jan 2, 2001
173
US
Have a parent form and a subform.

i want to select an app name from the combo box in the parent form, and have it load all the information for the subform. how can i go about doing this? The point of this form is to edit already-added records
 
You could simply use your combo box AfterUpdate event to set the subform filter with the value selected in the combo box and then refresh your subform.


Private sub comboBox_AfterUpdate()
YourSubform.Filter = "WhateverField = " & comboBox
YourSubform.FilterOn = True
YourSubform.Requery
End if
 
what do i put for "whatever field"
 
EvilCabal means to use the link between the parent and child relationship. "WhateverField" should represent the primary and foreign key relations.

For example, if you've got a Master table and a Detail table. Master table PK is InvoiceID. Detail FK is Invoice ID. Assume the comboBox lists data from the Master table showing InvoiceID. You're sub(Child) displays all the detail of that Master InvoiceID. You're code would look like this...
Code:
Private sub comboBox_AfterUpdate()
    YourSubform.Filter = "InvoiceID = " & comboBox
    YourSubform.FilterOn = True
    YourSubform.Requery
End if

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top