Hello all:
I'm trying to include a variable (form value integer) in my SQL statement and I'm having difficulty with the syntax. I tried using VALUES without success. My code (removed extraneous VBA stuff):
I am trying to insert "strInteger" into TableB in the "IntegerID" slot.
I *know* I am not getting the syntax right to insert the variable. (the error messages are a hint) However, I am stuck. Does anyone know how I might do this?
Much appreciated!
A.
I'm trying to include a variable (form value integer) in my SQL statement and I'm having difficulty with the syntax. I tried using VALUES without success. My code (removed extraneous VBA stuff):
I am trying to insert "strInteger" into TableB in the "IntegerID" slot.
Code:
dim strInteger as Integer
[indent]
strInteger = Me.FormField.Value
strSQL = "INSERT INTO TableB ( Item, CategoryCode, SelectorCode, Description, ScoringAmount, IntegerID ) " _
& "SELECT TableA.ID, TableA.CategoryCode, TableA.SelectorCode, TableA.Description, TableA.ScoringAmount,('&strInteger&') " _
& "FROM TableA; "
CurrentDb.Execute strSQL, dbFailOnError
'etc., etc.
[/indent]
I *know* I am not getting the syntax right to insert the variable. (the error messages are a hint) However, I am stuck. Does anyone know how I might do this?
Much appreciated!
A.