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

display subform with selectd record - nearly there?

Status
Not open for further replies.

neilmcdonald

Technical User
Aug 16, 2002
53
Hi,

I have a main form with a subform. command buttons on the main form control the recordsource for the subform. I have a continous form and a another form with more details.

What I would like to be able to do is double click the row on the continous form, and display the other subform with the current record.

I've got this far...

Dim JobNo As Integer
JobNo = Me.JobID.Value
DoCmd.OpenForm "JobForm", , , "JobId = " & JobNo, , acHidden
Forms!Main.SubForm.SourceObject = "JobForm"

I find that the Docmd.Openform line works fine if the form is not hidden, but as soon as I set the subform source object to be the jobform, it defaults back to the first record.

I'm obviously missing something here - can somebody help me out?

Thanks,

Neil
 
It seems to me that it may be best to have two subforms, each of which can be hidden in a appropriate way. The subforms can be linked on child and master fields. You may wish to look at the Customers Order form in the Northwind sample database. Otherwise, you could store a unique ID to either a hidden field in the main table that can be used as a link field, or to a variable, that can be used to find the correct record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top