Syntax error

A

Alain

Hi to all

Can anybody help me with this syntax error

CurrentDb.Execute _
"INSERT INTO tbl-Leases(IdBranch,LeaseName)" & _
"VALUES(& num, " & val & ")", dbFailOnError

num is integer
val is string

Thanks

Alain
 
T

Ted Allen

It looks like you may be missing a space after your close ) before VALUES,
and also it looks like you may be missing some concatenation's and a string
delimiter. Try the following to see if it will work:

CurrentDb.Execute _
"INSERT INTO tbl-Leases (IdBranch,LeaseName) " & _
"VALUES (" & num &", '" & val & "')", dbFailOnError

HTH, Ted Allen
 
A

Alain

Thanks Ted,

although I tried all possibilities and always giving me errors I'll try
yours Monday am

Alain
 
Top