473,657 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CurrentProject. Connection.Exec ute Insert Into

Why does CurrentProject. Connection.Exec ute "qryStoresImpor t5ToStage",
RecordsAffected , adCmdText return the error:

Run-time error'-2147217900(8004 0e14)': Invalid SQL statement; Expected
'DELETE','INSER T','PROCEDURE', 'SELECT, OR 'UPDATE'.

but

Dim SQL As String
SQL = "INSERT INTO StoresStage ( StoreNumber, StoreName,
StoreAddress1, StoreAddress2, StoreCity, StoreState, StorePostalCode ,
StoreCountry, StorePhone, AddressComplete , OpenDate,
ConstructionSta tus )SELECT StoresImport.St oreNumber,
StoresImport.St oreName, StoresImport.St oreAddress1,
StoresImport.St oreAddress2, StoresImport.St oreCity,
StoresImport.St oreState, StoresImport.St orePostalCode,
StoresImport.St oreCountry, StoresImport.St orePhone,
StoresImport.Ad dressComplete, StoresImport.Op enDate,
StoresImport.Co nstructionStatu s FROM StoresImport WHERE
StoresImport.St oreNumber Is Not Null;"
CurrentProject. Connection.Exec ute SQL, RecordsAffected , adCmdText

the exact same SQL, works fine?

CurrentProject. Connection.Exec ute 'Every other query I use',
RecordsAffected , adCmdText also works.
Nov 13 '05 #1
0 4767

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5322
by: Jill Graham | last post by:
Hi, I'm using an access database and found following problem : I have a table X with 2 records : record 1 & record 2. I execute following procedure with 2 steps : 1. The procedure deletes records 1 : connection.execute "delete from X record 1" 2. The procedure adds record 1 again using the recordset object.
7
4557
by: Lauren Quantrell | last post by:
I used to force a new connection between my Access 2K database and a SQL Server backend every time the user launches the application, but it seemed very slow, in fact using a timer function, I determined this accounted for 90% of the startup time. I am toying with this method below, where I use CurrentProject.isConnected. My thought is that Access makes the connection (based on the info provided in the connection dialog) anyway, so why...
6
13485
by: alex.hatzisavas | last post by:
Hi all. I'm having a serious problem when i'm trying to use the CurrentProject.Connection property for some ADO manipulation. Here's the error message i'm getting: Run-time error '-2147220999 (800401f9)': Method 'Connection' of object '_CurrentProject' failed
0
1847
by: cyberdwarf | last post by:
Hi y'all I like to be able to trap the OnClose event for the CurrentProject.Connection in my ADE. As this is a very large project, I can't see where, or how I should insert the code to reconnect to the SQL server if the connection is lost when the user is away from the workstation for a while..... Anyone got any ideas? All help greatly appreciated
20
7201
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I get the error "There is already an open DataReader associated with this Connection which must be closed first." How can I fix this error ? For each DataReader, do I want to open and close the connection (in this case adoCon) to avoid this error ?...
1
2461
by: Subangini | last post by:
"Hi, I am trying to migration Oracle database to mysql database using visual coding. I am having problem in the Do until loop, can u tell me what is the mistake. Oracle Database - Oracle rdb with VMS operating system Mysql- version 5 Visual basic - version 6.0 Since my host machine Oracle is an older version I have problem, do
15
12366
by: Andyza | last post by:
I'm looking at another developers code and I'm now confused about the correct way to close a database connection and destroy the object. I would normally do it this way: Set conn = Server.CreateObject("adodb.connection") conn.Execute(UPDATE TABLE Blah Set Something = 'Somevalue' WHERE whatever = 'blah') conn.Close Set conn = nothing
6
8156
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql server mobile ce database. Until recently I was synching everything thru a com port serial cable. The devices would connect to the computer thru activesync and are able to acquire an internet connection. The sync for the program occurs thru a website...
3
3447
by: irkahs | last post by:
Hello all, I am using an SQL select statement to store the result into a variable. This variable then needs to get into a table. I am having issues with it. Kindly help. I am providing below the code. 'First table variables Dim sql_insert, con, data_source 'Second table variables Dim sql_insert2, con2, data_source2
0
8310
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
8827
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...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4158
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
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
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
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.