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

Subforms?

Status
Not open for further replies.

tom05

Programmer
Oct 25, 2008
4
AU
Any tips on how I can move to a particular record in a query result that is displayed in datasheet view as a subform on another form. I am not sure of the referencing. This is to occur when a command button is clicked on a completely different form (which runs the query).
Thanks.
 
G'day,

Cant guarantee but something like:

Code:
docmd.openform "YurSubForm",,"ID="& forms!otherform!ID

Not sure how many commas you need but you want to be setting the "Where" clause.

Good luck,

JB
 
Thanks for your reply but I am not sure what you mean by "ID="
Do I type that or is there an ID number or reference for my forms?
 
It would help if you provided the forms, subform, and control names as well the field name and data type. Generically if the unique field name is PKField and it is numeric:
Code:
Dim strWhere as String
strWhere = "[PKField]= " & Forms!frmMainForm!sfrmName.Form.PKFieldControlOnSubform
DoCmd.OpenForm "frmYourFormName", , , strWhere

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top