473,786 Members | 2,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HELP Syntax error in sql insert into

I am going blind tonight but I cannot figure out the error. I get a
syntax error from this sql statement, being run via vba in access 2003

insert into tbl_Volunteer_D onor in "C:\AgencySyste mVer1.32.mdb" (
[Company],[ID],[Updated],[PositionTitle],[CompanyMatchInf o],[Last
Name],[First
Name],[Sex],[Address],[City/State/Zip],[DoNotMail],[email],[Phone1#],[Phone2#],[Phone2Type],[Volunteer],[Donor],[Comments],[OriginalDateSer vice],[Phone1Type])
select
([Company],[ID],[Updated],[PositionTitle],[CompanyMatchInf o],[Last
Name],[First
Name],[Sex],[Address],[City/State/Zip],[DoNotMail],[email],[Phone1#],[Phone2#],[Phone2Type],[Volunteer],[Donor],[Comments],[OriginalDateSer vice],[Phone1Type])
from tbl_Volunteer_D onor in "C:\SapulpaComm unity Care NEW.mdb";

I am trying to copy the exact same fields (but not all the available
fields) from a table in one database to a same named table with a
slightly different definition, but having all these fields, in another
database.

Can someone set me straight on the syntax error?
Reserved word? True syntax error? Something else?

Bob
Jan 25 '06 #1
2 5734
Bob Alston wrote:
I am going blind tonight but I cannot figure out the error. I get a
syntax error from this sql statement, being run via vba in access 2003

insert into tbl_Volunteer_D onor in "C:\AgencySyste mVer1.32.mdb" (
[Company],[ID],[Updated],[PositionTitle],[CompanyMatchInf o],[Last
Name],[First
Name],[Sex],[Address],[City/State/Zip],[DoNotMail],[email],[Phone1#],[Phone2#],[Phone2Type],[Volunteer],[Donor],[Comments],[OriginalDateSer vice],[Phone1Type])
select
([Company],[ID],[Updated],[PositionTitle],[CompanyMatchInf o],[Last
Name],[First
Name],[Sex],[Address],[City/State/Zip],[DoNotMail],[email],[Phone1#],[Phone2#],[Phone2Type],[Volunteer],[Donor],[Comments],[OriginalDateSer vice],[Phone1Type])
from tbl_Volunteer_D onor in "C:\SapulpaComm unity Care NEW.mdb";

I am trying to copy the exact same fields (but not all the available
fields) from a table in one database to a same named table with a
slightly different definition, but having all these fields, in another
database.

Can someone set me straight on the syntax error?
Reserved word? True syntax error? Something else?

Bob

ok SIMPLIFIED A BIT,

The following works fine:

INSERT INTO tbl_Volunteer_D onor IN 'C:\AgencySyste mVer1.32.mdb' SELECT
* FROM tbl_Volunteer_D onor IN 'C:\SapulpaComm unity Care NEW.mdb';
But if I replace "*" with "([fieldname])" it gives me the error:

circular reference caused by alias 'fieldname' in query definition

I need to be able to select specific fields not all fields.

Ideas?
Jan 25 '06 #2
Bob Alston wrote:
Bob Alston wrote:
I am going blind tonight but I cannot figure out the error. I get a
syntax error from this sql statement, being run via vba in access 2003

insert into tbl_Volunteer_D onor in "C:\AgencySyste mVer1.32.mdb" (
[Company],[ID],[Updated],[PositionTitle],[CompanyMatchInf o],[Last
Name],[First
Name],[Sex],[Address],[City/State/Zip],[DoNotMail],[email],[Phone1#],[Phone2#],[Phone2Type],[Volunteer],[Donor],[Comments],[OriginalDateSer vice],[Phone1Type])
select
([Company],[ID],[Updated],[PositionTitle],[CompanyMatchInf o],[Last
Name],[First
Name],[Sex],[Address],[City/State/Zip],[DoNotMail],[email],[Phone1#],[Phone2#],[Phone2Type],[Volunteer],[Donor],[Comments],[OriginalDateSer vice],[Phone1Type])
from tbl_Volunteer_D onor in "C:\SapulpaComm unity Care NEW.mdb";

I am trying to copy the exact same fields (but not all the available
fields) from a table in one database to a same named table with a
slightly different definition, but having all these fields, in another
database.

Can someone set me straight on the syntax error?
Reserved word? True syntax error? Something else?

Bob


ok SIMPLIFIED A BIT,

The following works fine:

INSERT INTO tbl_Volunteer_D onor IN 'C:\AgencySyste mVer1.32.mdb' SELECT
* FROM tbl_Volunteer_D onor IN 'C:\SapulpaComm unity Care NEW.mdb';
But if I replace "*" with "([fieldname])" it gives me the error:

circular reference caused by alias 'fieldname' in query definition

I need to be able to select specific fields not all fields.

Ideas?

Ok think I have it. I have to qualify the field name with a table name
so this works

INSERT INTO tbl_Volunteer_D onor IN 'C:\AgencySyste mVer1.32.mdb' SELECT
xxx.company FROM tbl_Volunteer_D onor AS xxx IN 'C:\SapulpaComm unity
Care NEW.mdb';
Jan 25 '06 #3

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

Similar topics

15
7398
by: Jack | last post by:
I have a text file of data in a file (add2db.txt) where the entries are already entered on separate lines in the following form: INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere. Good food.", " (Harry Houdini - 03/01/2004)"); INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada", " (Herbert Hoover - 03/03/2004)"); INSERT INTO `reviews` VALUES("", "Golden Dragon", "Lunch", "Exquisite.
699
34241
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
28
3307
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical make-believe challenge in order to avoid confusing the issue further. Suppose I was hosting a dinner and I wanted to invite exactly 12 guests from my neighborhood. I'm really picky about that... I have 12 chairs besides my own, and I want them all...
24
22652
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double quotes? Do I need to use code to scrub each string and remove or escape the double quotes before using it in a query? The error I get is this: Error Number 3075: Syntax error (missing operator) in query expression '"credit card billed by...
7
6675
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double checked, and the insert works fine (tried to use it from access)... im using visual C# express 2k5... what could be wrong? thanks!
1
5427
by: Joe | last post by:
Hello All, I am trying to insert a record in the MS Access DB and for some reason I cannot get rid of error message, System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. And the line it shows in red is cmd.ExecuteNonQuery()
1
3722
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am online. Plz....Plz..Plz...
3
1658
by: david | last post by:
I have following code, but I do not know where the problem is. Thank you for any help. David ----Code--- 'connection conn = New SqlConnection _ ("data source=localhost;integrated security=true;initial catalog=DemoCRQdatabase")
6
6005
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into it has been troublesome to say the least. My ASP.NET script is supposed to execute an INSERT INTO statement in order to add a user to the database. Here is a sample:
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
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
10164
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...
1
10110
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
6745
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
5397
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...
1
4066
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
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.