Hi,
I am creating a button that needs to open another form. Going through the wizard, I am only able to set the criteria for one field to match, except I want to use 2 fields to designate the filter that needs to be placed on the opening of the new form.
I know that I need to do something to the stLinkCriteria VBA code but it's not working quite right. I have added an And statement to the original criteria, but it does not seem to take.
Thanks for your help,
Tom
Private Sub Command29_Click()
On Error GoTo Err_Command29_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "44-1 frm_Script_Detail_ from_45"
stLinkCriteria = "[Test Script ID]=" & "'" & Me![Test Script ID] & "'" And [Test Case ID] = Me![Test Case ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command29_Click:
Exit Sub
Err_Command29_Click:
MsgBox Err.Description
Resume Exit_Command29_Click
End Sub
I am creating a button that needs to open another form. Going through the wizard, I am only able to set the criteria for one field to match, except I want to use 2 fields to designate the filter that needs to be placed on the opening of the new form.
I know that I need to do something to the stLinkCriteria VBA code but it's not working quite right. I have added an And statement to the original criteria, but it does not seem to take.
Thanks for your help,
Tom
Private Sub Command29_Click()
On Error GoTo Err_Command29_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "44-1 frm_Script_Detail_ from_45"
stLinkCriteria = "[Test Script ID]=" & "'" & Me![Test Script ID] & "'" And [Test Case ID] = Me![Test Case ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command29_Click:
Exit Sub
Err_Command29_Click:
MsgBox Err.Description
Resume Exit_Command29_Click
End Sub