Insert Into SQL Syntax

LanaR

Member
Local time
Today, 12:38
Joined
May 20, 2021
Messages
113
The following SQL works fine as a Query

Code:
StrSQL = "INSERT INTO TBL_TastNote ( WineID, AuthID, [Note] ) " & _
            "SELECT TBL_Wine.WineID, TBL_Wine.Wine, 4 AS Expr1, 'See Attatched PDF' AS Expr2 " & _
            "FROM TBL_Wine " & _
            "WHERE (((TBL_Wine.WineID)=[forms]![FRM_Wine]![WineID])); "

But causes the following error when implemented in VBA

1641660522554.png
 
You are selecting 4 values and attempting to "INSERT" into 3 fields.
 
 
Put the sql into a string variable and then debug.print that to see what you actually have, not what you think you have.
Then use that in the command when you get it correct.

if you still cannot see the error, then you can always post the output here ?
 

Users who are viewing this thread

Back
Top Bottom