dariyoosh
New member
- Local time
- Today, 10:50
- Joined
- Mar 8, 2010
- Messages
- 6
A question about the error message "Run-time error '3061' Too few parameters, Expecte
Dear all,
I would like to ask a question about Execute method in DAO Database object and I would appreciate if you could kindly give me a hand. I have an update SQL query operating on a table with a single numerical column. The query multiplies by 2 each even value. I tested on oracle the following SQL query and I observed that it does the job pretty well:
Now I want to run the very same query with VBA by calling the Execute method of DAO.Database object. Here is my code:
However, when I run the above code, I receive the following error message:
Runtime Error: 3061: Two few parameters, expected 1.
I have been googling for a while for this error message on different forums, yet I haven't managed to deal with this problem.
Any idea?
Where is the error in my program?
Thanks in advance,
Kind Regards,
Dariyoosh
Dear all,
I would like to ask a question about Execute method in DAO Database object and I would appreciate if you could kindly give me a hand. I have an update SQL query operating on a table with a single numerical column. The query multiplies by 2 each even value. I tested on oracle the following SQL query and I observed that it does the job pretty well:
Code:
UPDATE mytesttable SET numval = (numval * 2)
WHERE (MOD(numval,2) = 0);
Code:
Public Sub dbExecteCmdExample()
Dim myDatabase As DAO.Database
Dim strSQL As String
Set myDatabase = CurrentDb
strSQL = "UPDATE mytesttable SET numval = (numval * 2) WHERE ((numval MOD 2) = 0)"
myDatabase.Execute strSQL, dbFailOnError
Set myDatabase = Nothing
End Sub
Runtime Error: 3061: Two few parameters, expected 1.
I have been googling for a while for this error message on different forums, yet I haven't managed to deal with this problem.
Any idea?
Where is the error in my program?
Thanks in advance,
Kind Regards,
Dariyoosh