A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Syntax error (missing operator) in Query Expression bug



 
 
Thread Tools Display Modes
  #1  
Old October 25th, 2007, 01:49 PM posted to microsoft.public.access.tablesdbdesign
carmen
external usenet poster
 
Posts: 52
Default 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  
Old October 25th, 2007, 02:33 PM posted to microsoft.public.access.tablesdbdesign
Duane Hookom
external usenet poster
 
Posts: 7,177
Default 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  
Old October 25th, 2007, 02:44 PM posted to microsoft.public.access.tablesdbdesign
carmen
external usenet poster
 
Posts: 52
Default 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  
Old October 25th, 2007, 02:59 PM posted to microsoft.public.access.tablesdbdesign
Duane Hookom
external usenet poster
 
Posts: 7,177
Default 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  
Old October 25th, 2007, 03:45 PM posted to microsoft.public.access.tablesdbdesign
carmen
external usenet poster
 
Posts: 52
Default 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  
Old October 25th, 2007, 05:33 PM posted to microsoft.public.access.tablesdbdesign
Duane Hookom
external usenet poster
 
Posts: 7,177
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.