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)
I want to change the ServerName field.
I am getting a runtime error of “3067: Query must contain at least 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 tried adding a semi-colon to the end. I made sure my table is called tblLoanDetails and my Column names are ServerName, and ID.
Assuming you want to add a new record, you shouldn’t have a
WHEREclause in this case, since there are no records to examine. Do this:If instead you wish to modify an existing record, do this: