G
Guest
I created a command button that allows the users to go to the general ledger
form for a specific check ID #. It works for records that beginnings with an
alphabet in the pub ID field but doesn't work in the records that beginning
with a numerial in the pub ID field.
This is the error message I receive: Syntax error (missing operator) in
query expression '[CheckID]=4CLJ'.
Here is the code:
Private Sub Command198_Click()
On Error GoTo Err_Command198_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "General Ledger"
stLinkCriteria = "[CheckID]=" & Me![PubID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command198_Click:
Exit Sub
Err_Command198_Click:
MsgBox Err.Description
Resume Exit_Command198_Click
End Sub
Can someone tell me what I need to change in order for this command to work?
I've tried the following from another person's question:
stLinkCriteria = "[CheckID]=" & "'" & Replace(Me![PubID],"'","'") & "'"
and also
stLinkCriteria = "[CheckID]=""" & Me![PubID] & """"
and the result was this error message: The OpenForm action was cancelled.
Can someone help me with this?
form for a specific check ID #. It works for records that beginnings with an
alphabet in the pub ID field but doesn't work in the records that beginning
with a numerial in the pub ID field.
This is the error message I receive: Syntax error (missing operator) in
query expression '[CheckID]=4CLJ'.
Here is the code:
Private Sub Command198_Click()
On Error GoTo Err_Command198_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "General Ledger"
stLinkCriteria = "[CheckID]=" & Me![PubID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Command198_Click:
Exit Sub
Err_Command198_Click:
MsgBox Err.Description
Resume Exit_Command198_Click
End Sub
Can someone tell me what I need to change in order for this command to work?
I've tried the following from another person's question:
stLinkCriteria = "[CheckID]=" & "'" & Replace(Me![PubID],"'","'") & "'"
and also
stLinkCriteria = "[CheckID]=""" & Me![PubID] & """"
and the result was this error message: The OpenForm action was cancelled.
Can someone help me with this?