473,387 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Convert Access append query to VBA Code

Hello all,

I have a append query that works great if I just run the query via Access. I
need to convert that query into VBA code. Here is the SQL View of the query
I'm trying to convert:

INSERT INTO TblInitiator IN 'X:\Archive\TestFinal\080107\TS3000v101_be.mdb'
SELECT tblAddInitiator.*
FROM tblAddInitiator;

What the query does is append the table called tblInitiator located in a
network location from values in a table called tblAddInitiator. There is only
one field in each of the tables both called fldInitiator

I tried this VBA statement (all on 1 line)

AppendDB = "INSERT INTO 'TblInitiator' IN [I:\Archive\TestFinal\080107\
TS3000v101_be.mdb] SELECT 'tblAddInitiator.*' FROM 'tblAddInitiator';"

I get the message:
Syntax error in query. Incomplete query clause

What am I missing from the statement? Help!!

Thanks in advance,

Clarence
Aug 7 '07 #1
3 19899
FishVal
2,653 Expert 2GB
Hello all,

I have a append query that works great if I just run the query via Access. I
need to convert that query into VBA code. Here is the SQL View of the query
I'm trying to convert:

INSERT INTO TblInitiator IN 'X:\Archive\TestFinal\080107\TS3000v101_be.mdb'
SELECT tblAddInitiator.*
FROM tblAddInitiator;

What the query does is append the table called tblInitiator located in a
network location from values in a table called tblAddInitiator. There is only
one field in each of the tables both called fldInitiator

I tried this VBA statement (all on 1 line)

AppendDB = "INSERT INTO 'TblInitiator' IN [I:\Archive\TestFinal\080107\
TS3000v101_be.mdb] SELECT 'tblAddInitiator.*' FROM 'tblAddInitiator';"

I get the message:
Syntax error in query. Incomplete query clause

What am I missing from the statement? Help!!

Thanks in advance,

Clarence
Hi, Clarence.

Try the following.

Expand|Select|Wrap|Line Numbers
  1. Docmd.RunSQL "<SQL statement exactly as it appears in query builder>"
  2.  
Aug 7 '07 #2
Does it all have to be on one line??
Aug 7 '07 #3
Does it all have to be on one line??

Fish,

I got it to work...thanks for your help today

Clarence
Aug 7 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: gpaille | last post by:
I got a big Access database I'd like to convert to MS SQL Server 2000 and I'm looking for an efficient automated tool to convert data (over 1 400 tables), query, forms and interface. Does...
0
by: karinski | last post by:
Hi All, I have a split f/e - b/e setup on my database with RWOP queries on the front end. The code below gets a PO number(s), and vendor name from a multi choice list box on another form. It...
1
by: David Barger | last post by:
Greetings, It appears that an Append Query I run in Access XP is randomly failing to append a field. I have payroll data being entered into a payroll database. This data is exported daily to...
3
by: Bill Nicholson | last post by:
What tools are available to convert Access projects (Forms, Code, Queries, Reports) to VB Dot Net? Does anyone have experience with this type of conversion? Please tell me I don't have to do it...
4
by: robboll | last post by:
When I try to use an append query from an oracle link it takes forever. I am exploring the idea of doing an append action using a pass-through query. If I have an Oracle ODBC connection to...
7
by: pltmcs | last post by:
I am trying to generate some records from one table into another. The problem is that the new table has an autonumber field (PID). The PID is part of the primary key since it is possible to have...
4
by: Sakakini | last post by:
How ccan append last entry form one table to another????
1
by: PaulW99 | last post by:
I'm an experienced mainframe programmer, but new to programming in Access. I have an application written in VBA that attempts to export the results of a query to an Excel spreadsheet using code like...
10
by: MeeMee | last post by:
Hi I have a problem appending data into an oracle table from access. I imported the new data from an excel sheet into a table in access and useed an append query to add the data into a linked...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.