473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MS ACCESS, Syntax error (missing operator)

Hi to everyone,

I have the following problem which is producing the following error:

Syntax error (missing operator) in query expression '(CourseNo = CN1863)

This caused from the follOwing being run from a command button on a form. The sync is between the form (Combo box ) and a report (txt field).

DoCmd.OpenReport "RptValidationMainP3_Course1863", acPrintPreview, , "CourseNo = " & Me.CourseNo

The report is based on a table which has many 'CourseNo's', and I want the chosen value from the form combo to filter the records to be printed in the report. i.e select CourseNo '1863' via the combo box on the form (with other fields input by the user) and then clicking the command button opens the report filtered to the combo box value.

My apologies if i've been a bit long winded describing this, and hope that there is enough here to show my problem.

Any assistance would be really appreciated.

My Thanks

Dave
Mar 3 '08 #1
6 16640
Stewart Ross
2,545 Expert Mod 2GB
...I have the following problem which is producing the following error:
Syntax error (missing operator) in query expression '(CourseNo = CN1863)
...
DoCmd.OpenReport "RptValidationMainP3_Course1863", acPrintPreview, , "CourseNo = " & Me.CourseNo
Hi Dave. This problem crops up fairly frequently in referring to string values, and arises because you are missing two quote marks from the filter statement. This should be:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "RptValidationMainP3_Course1863", acPrintPreview, , "CourseNo = '" & Me.CourseNo & "'"
Without the quote marks Access is trying to interpret the course name as a field name or operator, without success.

Add the quote marks in as shown and the DoCmd should be OK.

-Stewart
Mar 3 '08 #2
Hi Dave. This problem crops up fairly frequently in referring to string values, and arises because you are missing two quote marks from the filter statement. This should be:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "RptValidationMainP3_Course1863", acPrintPreview, , "CourseNo = '" & Me.CourseNo & "'"
Without the quote marks Access is trying to interpret the course name as a field name or operator, without success.

Add the quote marks in as shown and the DoCmd should be OK.

-Stewart

Hi Stewart,

Works a treat!. This is one thing i will pop in my good gen folder. Many many thanks, and I am smiling like a 3 year old kid!!

with best wishes, Dave
Mar 3 '08 #3
Stewart Ross
2,545 Expert Mod 2GB
Hi Stewart,

Works a treat!. This is one thing i will pop in my good gen folder. Many many thanks, and I am smiling like a 3 year old kid!!

with best wishes, Dave
Very glad to have been able to help, Dave.

Regards

Stewart
Mar 3 '08 #4
I was running into this same problem and it turned out that I was missing the quotation marks as susggested. This got me past that hurdle however I know have a new problem.

Now when I go to open the report I am present with a message box asking me to input the value that is referenced in the filter.

Anyone with ideas?
Aug 15 '08 #5
Stewart Ross
2,545 Expert Mod 2GB
Hi jghouse. We'd need to know a bit more about your problem before we can answer it, and as it really does not relate to this particular thread it would be better to start a new discussion thread for your current difficulty.

If you could please do so, posting the code that is used to open your report, it would be much appreciated.

Thanks

Stewart

...Now when I go to open the report I am present with a message box asking me to input the value that is referenced in the filter.
Aug 15 '08 #6
Hi jghouse. We'd need to know a bit more about your problem before we can answer it, and as it really does not relate to this particular thread it would be better to start a new discussion thread for your current difficulty.

If you could please do so, posting the code that is used to open your report, it would be much appreciated.

Thanks

Stewart
Stewart,

Thanks to your attention on this. After a night away from it I realized an unbelievably stupid error. My issue is not fixed but this thread was helpful in oslving my original one. Thanks again for all you do.
Aug 15 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
4
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out...
1
by: Alan Murrell | last post by:
Hello, One of our web hosting clients is getting the following error when someone tried to log in form their login page: --- ODBC ERROR --- Microsoft OLE DB Provider for ODBC Drivers error...
1
by: chug | last post by:
I'm not a programmer but it's my job to solve this. Can someone help me with this error message? Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Syntax error (missing operator)...
4
Tog
by: Tog | last post by:
Hello, I have read several posts with this heading but none of them have helped. I have the following error message: Syntax error (missing operator) in query expression 'left(Your Product...
3
by: access baby | last post by:
I hava a date parameter filter query but it shows error Syntax error missing operator in query experssion can some one please help where am i going wrong in expression SELECT copyorderdtl * ...
4
by: nerd4access | last post by:
Hello all! I am not new to access, but new to coding (and posting). I have a database that I have created and need some help with a login form. When a user opens the database, a form pops up...
2
by: aaron6098 | last post by:
I am trying to finish my final project for my programing class. i keep on getting Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E14) Syntax error (missing operator) in query...
4
by: munkee | last post by:
I am trying to dynamically update the rowsource of a chart within access. To achieve this I moved the original rowsource sql of the chart which is: SELECT tblParetoRaising.NCType,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.