Solved

MS Access VBA Query message=select statement includes a reserved word or argument or...

Posted on 2010-11-23
3
420 Views
Last Modified: 2012-05-10
I have a query in MS Access 2003 VBA that I copied from a QBE design that was working.
I am getting a message that the select statement includes a reserved word or argument or... punctuation is incorrect.
In one Query I look for oldMonth without matching new month and the second query is the same but new month without old month.
I can't find the cause of the message.
This doesn't work
SELECT Tbl_NewMonth.F1, Tbl_NewMonth.F2, Tbl_NewMonth.F3, Tbl_NewMonth.F4, Tbl_NewMonth.F5, Tbl_NewMonth.F6, Tbl_NewMonth.F7, Tbl_NewMonth.F8, Tbl_NewMonth.F9, Tbl_NewMonth.F10, Tbl_NewMonth.F11, Tbl_NewMonth.F12, Tbl_NewMonth.F13, Tbl_NewMonth.F14, Tbl_NewMonth.F15, Tbl_NewMonth.F16, Tbl_NewMonth.F17, Tbl_NewMonth.F18, Tbl_NewMonth.F19, Tbl_NewMonth.F20, Tbl_NewMonth.F21, Tbl_NewMonth.F22, Tbl_NewMonth.F23, Tbl_NewMonth.F24, Tbl_NewMonth.F25, Tbl_NewMonth.F26, Tbl_NewMonth.F27, Tbl_NewMonth.F28, Tbl_NewMonth.F29 INTO {Ttbl_NewMonth Without Matching OldMonth} FROM Tbl_NewMonth LEFT JOIN Tbl_OldMonth ON Tbl_NewMonth.F3 = Tbl_OldMonth.F3 WHERE (((Tbl_OldMonth.F3) Is Null));

This works
SELECT Tbl_OldMonth.F1, Tbl_OldMonth.F2, Tbl_OldMonth.F3, Tbl_OldMonth.F4, Tbl_OldMonth.F5, Tbl_OldMonth.F6, Tbl_OldMonth.F7, Tbl_OldMonth.F8, Tbl_OldMonth.F9, Tbl_OldMonth.F10, Tbl_OldMonth.F11, Tbl_OldMonth.F12, Tbl_OldMonth.F13, Tbl_OldMonth.F14, Tbl_OldMonth.F15, Tbl_OldMonth.F16, Tbl_OldMonth.F17, Tbl_OldMonth.F18, Tbl_OldMonth.F19, Tbl_OldMonth.F20, Tbl_OldMonth.F21, Tbl_OldMonth.F22, Tbl_OldMonth.F23, Tbl_OldMonth.F24, Tbl_OldMonth.F25, Tbl_OldMonth.F26, Tbl_OldMonth.F27, Tbl_OldMonth.F28, Tbl_OldMonth.F29 INTO [Ttbl_OldMonth Without Matching NewMonth] FROM Tbl_OldMonth LEFT JOIN Tbl_NewMonth ON Tbl_OldMonth.F3 = Tbl_NewMonth.F3 WHERE (((Tbl_NewMonth.F3) Is Null));

Open in new window

0
Comment
Question by:Mswetsky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 500 total points
ID: 34197260
In the non-working query you have used { } instead of [ ]after the word Into
0
 
LVL 3

Expert Comment

by:cnjuguna
ID: 34197289
hi mswetsky,

could you provide both select statements possibly in the context of the piece of code where you are getting that error?

cnjuguna
0
 
LVL 1

Author Closing Comment

by:Mswetsky
ID: 34197328
Thanks Peter that was the problem.
Man I am getting old and need to increase the screen size, :-)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question