error 3075- Syntax error

  • Thread starter Thread starter ajbarilla
  • Start date Start date
A

ajbarilla

I am trying to insert new records in a table with the following code:

QrySQL = ("insert into [tbl3] (document) select [testtbl].[field2]
WHERE [testtbl].[Field1]= '" & searchcrit & "'")
db.Execute QrySQL, dbFailOnError

but keep getting the following error: "Error 3075-Syntax error
(missing operator) in query expression.

its obviously an error with my syntax but im not sure where it is.
searchcrit is a string.

any help is appreciated
 
You're missing "FROM testtbl " in your SQL:

QrySQL = "insert into [tbl3] (document) select [testtbl].[field2] " & _
"FROM testtbl WHERE [testtbl].[Field1]= '" & searchcrit & "'"
 
Back
Top