Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

9 Experts available now in Live!

Get 1:1 Help Now