Beginner Access VBA SQL INSERT Question

Posted by Josh K on Stack Overflow See other posts from Stack Overflow or by Josh K
Published on 2010-06-01T20:09:28Z Indexed on 2010/06/01 20:13 UTC
Read the original article Hit count: 160

Filed under:
|
|

Syntax question: I am using the code below to call a query in Access VBA

strSQL = "INSERT INTO tblLoanDetails ([ServerName]) VALUES ('Test') WHERE [ID]=3"
Call CurrentDb.Execute(strSQL)

And i am getting a runtime error of "3067: Query must contain atleast one table or query."

the insert statement string looks like this (Threw the var into a text box):

INSERT INTO tblLoanDetails ([ServerName]) VALUES ('Test') WHERE [ID]=3

I also tried adding a semi-colon to the end but with no luck. I also double checked to make sure my table is called tblLoanDetails and my Column names are ServerName, and ID

Appreciate any help.

© Stack Overflow or respective owner

Related posts about sql

Related posts about vba