Solved

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

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

785 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