Solved

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

Posted on 2010-11-23
3
411 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now