I am trying to run a query in VBA based upon a query in Access. While
I have pulled out much of the original query while debugging, I still
am getting an Error in SELECT statement (error 3141) when attempting to
run it. I have pasted the query below:
Dim MyDB As DAO.Database
Dim MyRst As DAO.Recordset
Dim MySQL As String
Set MyDB = CurrentDb
MySQL = "SELECT [qry_Base_Extract].Aging_Load_Date,
[qry_Base_Extract].Group_Long_Name,
[qry_Base_Extract].Group_Short_Name, " & _
"[qry_Base_Extract].[FSC Name], [qry_Base_Extract].[FSC_#],
[qry_Base_Extract].Period_Created, [qry_Base_Extract].Inv_Created_Date,
" & _
"[qry_Base_Extract].Inv_Svc_Date, [qry_Base_Extract].Inv_Num,
[qry_Base_Extract].Inv_Amt, " & _
"FROM [qry_Base_Extract];"
Debug.Print MySQL
Set MyRst = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
....I'm sure I'm missing something simple. Any assistance would be
appreciated!!! Thanks. 3 1947
You've got a comma here where it doesn't belong:
"[qry_Base_Extract].Inv_Svc_Date, [qry_Base_Extract].Inv_Num,
[qry_Base_Extract].Inv_Amt, " & _
"FROM [qry_Base_Extract];"
There should be no comma between your SELECT ... and your FROM
statements. (so no comma after [qry_base_extract].Inv_Amt
One way to do this that's MUCH easier is to have the QBE build your
query, then if you hit the SQL button, you can copy and paste. The one
thing to remember, though, is that you have to fix the single quotes.
Hello,
Try rewriting your query without the extra "table" name before each field.
I know that Access puts this in by default when building a query, but it's
kind of cluttered when looking at vba code. Also, I don't think you need
the semi colon at the end.
"SELECT Aging_Load_Date,Group_Long_Name, Group_Short_Name, " & _
"[FSC Name], [FSC_#], Period_Created, Inv_Created_Date," & _
"Inv_Svc_Date, Inv_Num, Inv_Amt, " & _
"FROM qry_Base_Extract"
Linda
"Mike Dailey" <mi*********@ucphysicians.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com... I am trying to run a query in VBA based upon a query in Access. While I have pulled out much of the original query while debugging, I still am getting an Error in SELECT statement (error 3141) when attempting to run it. I have pasted the query below:
Dim MyDB As DAO.Database Dim MyRst As DAO.Recordset Dim MySQL As String
Set MyDB = CurrentDb
MySQL = "SELECT [qry_Base_Extract].Aging_Load_Date, [qry_Base_Extract].Group_Long_Name, [qry_Base_Extract].Group_Short_Name, " & _ "[qry_Base_Extract].[FSC Name], [qry_Base_Extract].[FSC_#], [qry_Base_Extract].Period_Created, [qry_Base_Extract].Inv_Created_Date, " & _ "[qry_Base_Extract].Inv_Svc_Date, [qry_Base_Extract].Inv_Num, [qry_Base_Extract].Inv_Amt, " & _ "FROM [qry_Base_Extract];"
Debug.Print MySQL
Set MyRst = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
...I'm sure I'm missing something simple. Any assistance would be appreciated!!! Thanks.
On Thu, 09 Jun 2005 20:01:44 GMT, "Linda Burnside"
<linda@nospam_burnsidebiz.com> wrote:
That advice will work if the field names are not ambiguous.
The semicolon is indeed not needed, but harmless.
-Tom. Hello,
Try rewriting your query without the extra "table" name before each field. I know that Access puts this in by default when building a query, but it's kind of cluttered when looking at vba code. Also, I don't think you need the semi colon at the end.
<clip> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kostatus |
last post by:
I have a virtual function in a base class, which is then overwritten by a
function of the same name in a publically derived class. When I call the
function using a pointer to the derived class...
|
by: Peter Olcott |
last post by:
www.halting-problem.com
|
by: Ian Stanley |
last post by:
Hi,
Continuing my strcat segmentation fault posting-
I have a problem which occurs when appending two sting literals using
strcat.
I have tried to fix it by writing my own function that does the...
|
by: Jon Davis |
last post by:
If I have a class with a virtual method, and a child class that overrides
the virtual method, and then I create an instance of the child class AS A
base class...
BaseClass bc = new ChildClass();...
|
by: Ammar |
last post by:
Dear All,
I'm facing a small problem.
I have a portal web site, that contains articles, for each article, the end
user can send a comment about the article.
The problem is:
I the comment length...
|
by: Dany |
last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
|
by: Mike Collins |
last post by:
I cannot get the correct drop down list value from a drop down I have on my
web form. I get the initial value that was loaded in the list.
It was asked by someone else what the autopostback was...
|
by: =?Utf-8?B?am8uZWw=?= |
last post by:
Hello All,
I am developing an Input Methop (IM) for PocketPC / Windows Mobile (PPC/WM).
On some
devices the IM will not start. The IM appears in the IM-List but when it is
selected from the...
|
by: sherifbk |
last post by:
Problem description
==============
- I have 4 clients and 1 server (SQL server)
- 3 clients are Monitoring console 1 client is operation console
- Monitoring console collects some data from...
|
by: AceKnocks |
last post by:
I am working on a framework design problem in which I have to design a C++ based framework capable of solving three puzzles for now but actually it should work with a general puzzle of any kind and I...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
|
by: F22F35 |
last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...
| |