Append query Select or Values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can't get this syntax right. I've tried both the Select and the Value
parameter, but to no avail. Error message indicates too few parameters.
Expected 2.

Can anyone help, please? Thanks for the help!

db.Execute "INSERT INTO CalcBank ([EmpNo], [Points]) Select [Emp] , [tot];"

Emp and tot are dimmed as number and are stored values.
CalcBank is the table name and EmpNo and Points are fields.
 
Lee said:
I can't get this syntax right. I've tried both the Select and the Value
parameter, but to no avail. Error message indicates too few parameters.
Expected 2.

Can anyone help, please? Thanks for the help!

db.Execute "INSERT INTO CalcBank ([EmpNo], [Points]) Select [Emp] , [tot];"

Emp and tot are dimmed as number and are stored values.
CalcBank is the table name and EmpNo and Points are fields.


You need to insert the values of the variables into the SQL
statement (SQL doesn't know what VBA variables are).

If you would assign the constructed SQL statement to a
string variable, you could display the statement to see what
its final form is.

strSQL = "INSERT INTO CalcBank ([EmpNo], [Points]) " _
& "VALUES( " & Emp & "," & tot & ")"
MsgBox strSQL ' test only
db.Execute strSQL
 
Back
Top