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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Insert statement with errors 5
Variables & SQL Statement 3
Dlookup syntax error #3 Please :-))) 6
Syntax error with function 1
Newbie with SQL & ADO 1
Dlookup & criteria No 2 7
Syntax Error 8
Type mismatch 4

Top