DAO and the unhelpful errors with Execute Failing

JaedenRuiner

Registered User.
Local time
Yesterday, 18:33
Joined
Jun 22, 2005
Messages
154
Okay,
So, I tried listening to the advice about using DAO as opposed to sql and it just doesn't work.

I simply need to execute an UPDATE query statement on a table in my database. So, I Open the database into a Database object. I then format my SQL into a string, and then Create a QueryDef.

Code:
  set db = OpenDatabase(Mydbfilename)
  set qdf = db.CreateQueryDef("", sqlString)
  qdf.Execute

And the Darned Execute line comes back with:
Run-Time Error '3061':
Too few parameters. Expected 8.

What is that?!?!? There is only one parameter for the execute method on the querydef object. At least that's what the Intellisense and Help documentation say.

i'm following the example used with the northwinds database directly from the help, so why is it failing?
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
 
My guess is that there are 8 form parameters in the SQL? If so, their values need to be concatenated into the string. The Execute method can not resolve form references.
 
Ahh,

Yea, i kept searching, and the problem was there weren't any parameters, but I had the sql formatted wrong for updating one table from another. I switched my "where" clause to an "INNER JOIN" clause and the sql worked flawlessly.
Thanks, anyway. :)

J"SD"a'RR
 

Users who are viewing this thread

Back
Top Bottom