473,386 Members | 1,791 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,386 software developers and data experts.

INSERT INTO PROBLEM

I have the following lines in a macro:
sql = "INSERT INTO IM (ITEM, DESC) VALUES (vitem, ndesc)"

DoCmd.RunSQL sql

Every time I execute the macro, I get a run time error saying there is a
syntax error in the INSERT INTO command. I have tried numerous variations
with the same result.

I would greatly appreciate anybody's help in pointing me in the right
direction.

John Cantlin
Nov 13 '05 #1
3 1821
The most obvious and likely culprit is "DESC", which it appears that you
have chosen as a field name. Unfortunately, it is a reserved SQL\Access
word, and cannot be used as a field name in any SQL. You will need to
change the field name.

There may of course be other problems.

BTW, save yourself a line of code and just write:

DoCmd.RunSQL "INSERT INTO IM (ITEM, DESC) VALUES (vitem, ndesc)"

Also, consider NOT using macros, but instead use VBA.
Darryl Kerkeslager

<jp*******@cox.net> wrote in message
news:cQnxd.60658$ka2.51585@fed1read04...
I have the following lines in a macro:
sql = "INSERT INTO IM (ITEM, DESC) VALUES (vitem, ndesc)"

DoCmd.RunSQL sql


Nov 13 '05 #2
.... and don't post twice under different messages, because I now see that
Mr. Steele already answered your question, so I just wasted 5 minutes of my
life, and I'm not getting any younger or smarter.
Darryl Kerkeslager

<jp*******@cox.net> wrote:

I would greatly appreciate anybody's help in pointing me in the right
direction.

John Cantlin

Nov 13 '05 #3
I apologize. The dup msg was a mistake..
"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:Ib********************@comcast.com...
... and don't post twice under different messages, because I now see that
Mr. Steele already answered your question, so I just wasted 5 minutes of my life, and I'm not getting any younger or smarter.
Darryl Kerkeslager

<jp*******@cox.net> wrote:

I would greatly appreciate anybody's help in pointing me in the right
direction.

John Cantlin


Nov 13 '05 #4

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

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
0
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
8
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with...
2
by: alexmaster_2004 | last post by:
hi i have made an application using C# that access sql2000. this application is just used to insert data to the database. i use something like this in my code: // string colmnA = TextBox1.Text;...
7
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
On a form - I have a datagridview which is docked to the entire form. The datagridview allows users to Delete and/or Add Rows. On the Form_Load event I Fill the datagridview source table with a...
6
by: sgulciny | last post by:
hi friends; I have problem about sql server insert and update in client side. I am coding windows application with c#.When I run my code in database server computer all is fine.I can see data,...
8
by: Red | last post by:
If auto-format is turned off in VS2008, there is apparently no way to indent a line. Under Tools->Options->Text Editor->C#->Formatting, there are three checkboxes. Unchecking those seems to cause...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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.