473,769 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert Access append query to VBA Code

10 New Member
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\Tes tFinal\080107\T S3000v101_be.md b'
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\Test Final\080107\
TS3000v101_be.m db] SELECT 'tblAddInitiato r.*' FROM 'tblAddInitiato r';"

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 19946
FishVal
2,653 Recognized Expert Specialist
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\Tes tFinal\080107\T S3000v101_be.md b'
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\Test Final\080107\
TS3000v101_be.m db] SELECT 'tblAddInitiato r.*' FROM 'tblAddInitiato r';"

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
clarencemo
10 New Member
Does it all have to be on one line??
Aug 7 '07 #3
clarencemo
10 New Member
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
4303
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 somebody can provide me with a list or, at least,a suggestion of tools that has already been used or well known for their efficiency.(except upsizing wizard and DTS, I tried with no success, since I'm not a programmer) Thanks,
0
1756
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 then assigns these values, plus a new receiving number, to the current form. The SQL string is an append query that copies select fields from the PO line items table into the receiving line items table and appends the current receiving number to...
1
2482
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 two csv files. (One for updated data, and the other for unupdated data.) The CSV files are attached to my Jobcosting database. After the CSV
3
12937
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 by hand! Thanks, Bill
4
7077
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 server OraTest. User: User1 Password: password and I am trying to append all records in table: tblTEST that are code: "abc"
7
5972
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 duplicate records. I did not include the PID in my append query since I just assumed it would be added automatically. My append does not add any records due to a key violation, which I assume is due to the PID not being set. How do I get the PID to...
4
1869
by: Sakakini | last post by:
How ccan append last entry form one table to another????
1
1796
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 this - DoCmd.OutputTo acOutputQuery, qryCountView, "Microsoft Excel (*.xls)", strXLSOutputFileName, False I have found on some occasions that the application falls over because the query code just seems to have disappeared. I cant find any...
10
6773
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 oracle table. The linked table has a composit primary key (Code, Org). The table in access has new data that are not in the oracle table and the data in the PK fields are not duplicated. I also made sure that both tables have same data types. I...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.