Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-23
3
Medium Priority
?
426 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

972 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