B
Bob Quintal
to refer to a control on a subform you need to go through theI'm trying to open a form via command button and show a
specific record in the main form as well as a specific record
in it's subform.
Here's my code:
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSingleContactPrint"
stLinkCriteria = "[PersonID]=" & Me![PersonID] & " AND "
[Forms]![frmInitialContactDetails]![DateOfContact] = " & Me!
[DateOfContact] "
DoCmd.OpenForm stDocName, , , stLinkCriteria
frmInitialContactDetails being the subform within
frmSingleContactPrint. All I get is a message saying access
can't find frmInitialContactDetails.
Can someone point out where I have went wrong with this code
or suggest a better way of using multiple link criteria?
parent form.
stLinkCriteria = "[PersonID]=" & Me![PersonID] & " AND "
subformcontrolname.form!DateOfContact = " & Me!
[DateOfContact] "
note that subformcontrolname may be the same as
[frmInitialContactDetails], but it may not. You will find the name
on the properties for the subbform, frmInitialContactDetails will
definitely be in the source object property, but you will want the
name property.