Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid SQL Syntax

Status
Not open for further replies.

PcLinuxGuru

Technical User
Nov 17, 2001
178
US
I am making a vb program that yanks data from a text file and puts it into a access db.

I kept erroring out on the sql in my prog. I attempted a sample query in access itself and it tells me "Invalid INSERT INTO" syntax. Here is what I typed as a query:

INSERT INTO TestTable (TestField) VALUES ("test")

Now I verified the tablename and the field name. I then tried:
INSERT INTO TestTable ('TestField') VALUES ("test")
and the error changes to an unknown field name like it does not exist.

This is access 2000. Is there anything I should be aware of. Most of my database experience is with mySQL but access seems to be kicking my butt.

 
And this ?
INSERT INTO TestTable (TestField) VALUES ('test')

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Actually now that I have had some sleep I see what it was.

The actual string was:
INSERT INTO TestTable (Time) VALUES ("test")

and time is an exclusive name. I verified this by renaming the fieldname in the table and it now works like a charm :)

 
So the correct syntax was:
INSERT INTO TestTable ([Time]) VALUES ("test")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
no there was no syntax error. I was using an exclusive name Time which you can not use. I believe date is another.

There is a list of exclusive names out there somewhere. I would imagine it was it was look for a field called 12:00:00 AM instead of just name.

I tried it in every form I could think of including the one you posted and the syntax error keeps coming up. Changing it to TimeOfDay solved it as TimeOfDay is not an exclusive variable or name.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top