By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,306 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

Insert statement into Access 2000 DB from VB6/ADO

P: n/a
I am trying to insert into a table in an Access 2000 DB from a VB6 app using
ADO 2.7.

I would have thought this should have been really easy but I cannot get it
working and I cannot see why. It is years and years since I did anything
with Access so I am wondering what I have forgotten...

I am sending a SQL string as follows directly from a connection object using
Connection.Execute(strSQL)
and I get an incorrect synatax error.

according to the debugger, I am sending this:

Insert into tbl_MCH_TIS
(Fund_Name, Fund_Class, TIS, Fund_Date)
Values("AA01", "A1", 0.88989, "06/27/2005");

but I also modified the code to send

Insert into tbl_MCH_TIS
(Fund_Name, Fund_Class, TIS, Fund_Date)
Values("AA01", "A1", 0.88989, #06/27/2005#);

and I tried

Insert into tbl_MCH_TIS
(Fund_Name, Fund_Class)
Values("AA01", "A1");

always the same result...a Syntax Error in SQL statement

Can anyone out there put me out of my misery...what is the correct syntax?

TIA

Paul BJ

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The syntax looks okay. You sure you haven't mistyped a field name?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Paul BJ" <pa**@spamlessbrownjohn.co.uk> wrote in message
news:42******@news.vo.lu...
I am trying to insert into a table in an Access 2000 DB from a VB6 app
using
ADO 2.7.

I would have thought this should have been really easy but I cannot get it
working and I cannot see why. It is years and years since I did anything
with Access so I am wondering what I have forgotten...

I am sending a SQL string as follows directly from a connection object
using
Connection.Execute(strSQL)
and I get an incorrect synatax error.

according to the debugger, I am sending this:

Insert into tbl_MCH_TIS
(Fund_Name, Fund_Class, TIS, Fund_Date)
Values("AA01", "A1", 0.88989, "06/27/2005");

but I also modified the code to send

Insert into tbl_MCH_TIS
(Fund_Name, Fund_Class, TIS, Fund_Date)
Values("AA01", "A1", 0.88989, #06/27/2005#);

and I tried

Insert into tbl_MCH_TIS
(Fund_Name, Fund_Class)
Values("AA01", "A1");

always the same result...a Syntax Error in SQL statement

Can anyone out there put me out of my misery...what is the correct syntax?

TIA

Paul BJ

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.