If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Syntax error (missing operator) in Query Expression bug
I created a command button that will send users straight to the Check ID#
requested and print that specific Check Request form. It works for records that start with an alphabet but I get this Syntax error message with the records that beginning with a numeral. Here is the code that the computer generated: 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 What else would I need to add to this code so that my records that beginning with numerals will also be able to go directly to check ID# specified? |
#2
|
|||
|
|||
Syntax error (missing operator) in Query Expression bug
If CheckID is a text field then you must delimit PubID.
stLinkCriteria = "[CheckID]=""" & Me![PubID] & """" -- Duane Hookom Microsoft Access MVP "Carmen" wrote: I created a command button that will send users straight to the Check ID# requested and print that specific Check Request form. It works for records that start with an alphabet but I get this Syntax error message with the records that beginning with a numeral. Here is the code that the computer generated: 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 What else would I need to add to this code so that my records that beginning with numerals will also be able to go directly to check ID# specified? |
#3
|
|||
|
|||
Syntax error (missing operator) in Query Expression bug
Duane
I've tried it and it still doesn't work. I'm getting an error message: The OpenForm actions was canceled. I copied and paste your suggestion into my code and still received the same error message. "Duane Hookom" wrote: If CheckID is a text field then you must delimit PubID. stLinkCriteria = "[CheckID]=""" & Me![PubID] & """" -- Duane Hookom Microsoft Access MVP "Carmen" wrote: I created a command button that will send users straight to the Check ID# requested and print that specific Check Request form. It works for records that start with an alphabet but I get this Syntax error message with the records that beginning with a numeral. Here is the code that the computer generated: 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 What else would I need to add to this code so that my records that beginning with numerals will also be able to go directly to check ID# specified? |
#4
|
|||
|
|||
Syntax error (missing operator) in Query Expression bug
The code to open the form is probably correct. I expect there is code running
in the new form that is the issue. What happens if you remove any code or macros from the new/opened form? -- Duane Hookom Microsoft Access MVP "Carmen" wrote: Duane I've tried it and it still doesn't work. I'm getting an error message: The OpenForm actions was canceled. I copied and paste your suggestion into my code and still received the same error message. "Duane Hookom" wrote: If CheckID is a text field then you must delimit PubID. stLinkCriteria = "[CheckID]=""" & Me![PubID] & """" -- Duane Hookom Microsoft Access MVP "Carmen" wrote: I created a command button that will send users straight to the Check ID# requested and print that specific Check Request form. It works for records that start with an alphabet but I get this Syntax error message with the records that beginning with a numeral. Here is the code that the computer generated: 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 What else would I need to add to this code so that my records that beginning with numerals will also be able to go directly to check ID# specified? |
#5
|
|||
|
|||
Syntax error (missing operator) in Query Expression bug
Duane:
I'm a little new at this so I'm really not understanding what you mean by remove any code or macros from the new/opened form? Where would I find that information? "Duane Hookom" wrote: The code to open the form is probably correct. I expect there is code running in the new form that is the issue. What happens if you remove any code or macros from the new/opened form? -- Duane Hookom Microsoft Access MVP "Carmen" wrote: Duane I've tried it and it still doesn't work. I'm getting an error message: The OpenForm actions was canceled. I copied and paste your suggestion into my code and still received the same error message. "Duane Hookom" wrote: If CheckID is a text field then you must delimit PubID. stLinkCriteria = "[CheckID]=""" & Me![PubID] & """" -- Duane Hookom Microsoft Access MVP "Carmen" wrote: I created a command button that will send users straight to the Check ID# requested and print that specific Check Request form. It works for records that start with an alphabet but I get this Syntax error message with the records that beginning with a numeral. Here is the code that the computer generated: 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 What else would I need to add to this code so that my records that beginning with numerals will also be able to go directly to check ID# specified? |
#6
|
|||
|
|||
Syntax error (missing operator) in Query Expression bug
I assume you have correctly modified your code to handle [CheckID] as a text
field. You have never confirmed whether CheckID is truly text. What is your exact code? Do you have any code in the On Open or On Current events of the form you are opening? -- Duane Hookom Microsoft Access MVP "Carmen" wrote: Duane: I'm a little new at this so I'm really not understanding what you mean by remove any code or macros from the new/opened form? Where would I find that information? "Duane Hookom" wrote: The code to open the form is probably correct. I expect there is code running in the new form that is the issue. What happens if you remove any code or macros from the new/opened form? -- Duane Hookom Microsoft Access MVP "Carmen" wrote: Duane I've tried it and it still doesn't work. I'm getting an error message: The OpenForm actions was canceled. I copied and paste your suggestion into my code and still received the same error message. "Duane Hookom" wrote: If CheckID is a text field then you must delimit PubID. stLinkCriteria = "[CheckID]=""" & Me![PubID] & """" -- Duane Hookom Microsoft Access MVP "Carmen" wrote: I created a command button that will send users straight to the Check ID# requested and print that specific Check Request form. It works for records that start with an alphabet but I get this Syntax error message with the records that beginning with a numeral. Here is the code that the computer generated: 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 What else would I need to add to this code so that my records that beginning with numerals will also be able to go directly to check ID# specified? |
Thread Tools | |
Display Modes | |
|
|