M
margaret
I have a form that I have a button that opens a report. I want it to open to
a specific criteria. I have the following code:
Private Sub Command111_Click()
On Error GoTo Err_Command111_Click
Dim stDocName As String
Dim stWhere As String
stDocName = "RPTNew Day by FullName"
stWhere = "[FullName]=" & Me![fullname]
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Command111_Click:
Exit Sub
Err_Command111_Click:
MsgBox Err.Description
Resume Exit_Command111_Click
End Sub
However, when opening it give me this message: Syntex error comma in query
expression '[fullname]=lname,fname' (obviously with the last name and first
name). I can run this report outside the form and it runs great, so I think
it has something to do with my stuff above.
Thanks.
a specific criteria. I have the following code:
Private Sub Command111_Click()
On Error GoTo Err_Command111_Click
Dim stDocName As String
Dim stWhere As String
stDocName = "RPTNew Day by FullName"
stWhere = "[FullName]=" & Me![fullname]
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Command111_Click:
Exit Sub
Err_Command111_Click:
MsgBox Err.Description
Resume Exit_Command111_Click
End Sub
However, when opening it give me this message: Syntex error comma in query
expression '[fullname]=lname,fname' (obviously with the last name and first
name). I can run this report outside the form and it runs great, so I think
it has something to do with my stuff above.
Thanks.