I have a form that I set the OnClick event to the following:
Private Sub Form_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmmainform"
stLinkCriteria = "[ReqID]=" & Me![ReqID]
'[ReqID] actually refers to a field name in the subform of frmMainForm
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
However, I want the subform's (frmRequestSubform) field value (ReqID) set to equal the ReqID of the record I select in the first form. If I set the field's value to one in the Main Form [PatientID] it works fine, but when I change it to [ReqID], the subform, it opens empty even when I write the entire path: forms!frmMainForm!frmRequestsubform.Form![ReqID]. What am I doing wrong?
Private Sub Form_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmmainform"
stLinkCriteria = "[ReqID]=" & Me![ReqID]
'[ReqID] actually refers to a field name in the subform of frmMainForm
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
However, I want the subform's (frmRequestSubform) field value (ReqID) set to equal the ReqID of the record I select in the first form. If I set the field's value to one in the Main Form [PatientID] it works fine, but when I change it to [ReqID], the subform, it opens empty even when I write the entire path: forms!frmMainForm!frmRequestsubform.Form![ReqID]. What am I doing wrong?