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

How to link RecordSource in Subform/Combo to Master/ID field

Status
Not open for further replies.

rf222

Programmer
Jan 29, 2004
94
US
The Master form has Studio ID field.

The subform has a combo box based on a query "Select * from Statement". I would like to add something like "Select * from Statement WHERE StudioID=" & Parent![StudioID]. Not sure if this will work.

I would also like to refresh the Subform's Combo Box once the record would change on the main form (Studio ID would change in this case...)
 
formerTexan (Programmer) Aug 3, 2006
Hi,

Open the combo box's rowsource in query design view and then add a parameter to the appropriate field that references the main form.

Forms!YourMainFormName!YourControlName

Then refresh the combo box from the main form's OnCurrent event (this will fire every time the record changes).

Forms("YourMainFormName")("YourSubFormControlName").form("YourComboBoxName").refresh

There are also many postings at this site on referencing objects such as forms and subforms. I recommend reading a couple. Access is highly flexible in the syntax it allows and so almost everyone goes through a bit of initial confusion.

CHeers,
Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top