Error 3061

  • Thread starter Thread starter Alain
  • Start date Start date
A

Alain

Hi, I need a little help with the Update syntax, I need to update multiple
fields but always get the error 3061 Too few parameters, expected 2

CurrentDb.Execute _
"UPDATE tblLease Set AreaLand = " & Me.AreaLand & "[,AreaLandSM = " &
Me.AreaLandSM & "] WHERE IdLease = " & num2 & ""
Can anyone explain to me what is wrong here, I am following the example
from Access books

PS using Access 2000

TIA

Alain
 
If Access finds any name that it does not recognise, it assumes it must be a
parameter. It typically means a field name has been spelled wrongly, or
there is something wrong with the SQL statement.

Assuming you have 3 Number type fields, and that all 3 have values in your
form (are not null), try this:

Dim strSql As String
strSql = "UPDATE tblLease SET AreaLand = " & Me.AreaLand & _
", AreaLandSM = " & Me.AreaLandSM WHERE ldLease = " & _
Me.num2 & ";"
Debug.Print strSql
CurrentDb.Execute strSql, dbFailOnError

By building a string, you can print it to the Immediate Window (Ctrl+G). You
can then see what is wrong with the string, and even copy it and paste it
into SQL View in a new query, to get more information about what is wrong
with it.

Note that if any of these fields are Text type (not Number type fields), you
need extra quotes.
 

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

Error 3061 2
3061 Error 5
Error 3061 when running update query from code 3
3061 Query Error 3
Error '3061' 2
Error 3061 2
SQL error 2
Run-time error 3061 excel to access 1

Back
Top