B
BrettS
Hi, trying to use the following code to open another form while retaining the
same [RE Job #] and [Sample #]:
Private Sub OpenMeasurement_Click()
On Error GoTo Err_OpenMeasurement_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "MeasData"
stLinkCriteria = "[RE Job #]='" & Me![RE Job #] & _
" and [Sample #]=" & Me![Sample #]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenMeasurement_Click:
Exit Sub
Err_OpenMeasurement_Click:
MsgBox Err.Description
Resume Exit_OpenMeasurement_Click
End Sub
However, when I use this code (with the values for RE Job # and Sample #
being A1226 and 2), I get this error message:
Syntax error in string in query expression '[RE Job #]='A1226 and [Sample
#]=2'.
Any help on how to fix this would be much appreciated, thank you.
same [RE Job #] and [Sample #]:
Private Sub OpenMeasurement_Click()
On Error GoTo Err_OpenMeasurement_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "MeasData"
stLinkCriteria = "[RE Job #]='" & Me![RE Job #] & _
" and [Sample #]=" & Me![Sample #]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenMeasurement_Click:
Exit Sub
Err_OpenMeasurement_Click:
MsgBox Err.Description
Resume Exit_OpenMeasurement_Click
End Sub
However, when I use this code (with the values for RE Job # and Sample #
being A1226 and 2), I get this error message:
Syntax error in string in query expression '[RE Job #]='A1226 and [Sample
#]=2'.
Any help on how to fix this would be much appreciated, thank you.