Hello,
I am trying to search a text field in a query. I use the code below, whenever I put the search criteria in the text box another box will pop up that says "Enter the parameter value", so I have to reenter the same search criteria and then it works. If I originally enter the search criteria with parenthesis around it, it works great, with no second box popping up. It's like it doesn't understand that it is text unless I put parenthesis around it.
Private Sub cmdLaunchTransactionReport_Click()
On Error GoTo Err_cmdLaunchTransactionReport_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim sCriteria
sCriteria = "[JobName]=" & txtJobName
stDocName = "rptTransactions"
DoCmd.OpenReport stDocName, acViewPreview, , sCriteria
Exit_cmdLaunchTransactionReport_Click:
Exit Sub
Err_cmdLaunchTransactionReport_Click:
MsgBox Err.Description
Resume Exit_cmdLaunchTransactionReport_Click
End Sub
I am trying to search a text field in a query. I use the code below, whenever I put the search criteria in the text box another box will pop up that says "Enter the parameter value", so I have to reenter the same search criteria and then it works. If I originally enter the search criteria with parenthesis around it, it works great, with no second box popping up. It's like it doesn't understand that it is text unless I put parenthesis around it.
Private Sub cmdLaunchTransactionReport_Click()
On Error GoTo Err_cmdLaunchTransactionReport_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim sCriteria
sCriteria = "[JobName]=" & txtJobName
stDocName = "rptTransactions"
DoCmd.OpenReport stDocName, acViewPreview, , sCriteria
Exit_cmdLaunchTransactionReport_Click:
Exit Sub
Err_cmdLaunchTransactionReport_Click:
MsgBox Err.Description
Resume Exit_cmdLaunchTransactionReport_Click
End Sub