Too few parameters??

DAW

Registered User.
Local time
Today, 14:27
Joined
Mar 22, 2006
Messages
70
:confused:
I have an append query that is called thus:
Code:
CurrentDb.Execute "_qry_PopulateTableUnionTemp"
It used to work fine, no problems, but I have made some minor changes to my db and now the code fails on this line with the message "runtime error 3061: Too few parameters Expected 2". What I don't get is that if I run the query directly by double-clicking in it then it works fine, but not in code.
I have searched this forum for this error and read lots, but nothing that I can relate directly to this! Please help!
 
Run your query in design mode and look what parameters you need to fill in. You have made a typo or you have deleted fields in your tables.
 
I have come across this error before and the only thing I could attribute it to was the way I was querying my linked tables. Exactly the same symptoms i.e. works when double-clicking from the database window, but not when calling it from VB.

From memory I tested it with a linked table and a local table, and using a control as one of the criteria; and couldn't get it to work with the linked table ... you're probably going to say it's not a linked table!!

Unfortunately, I had to do a workaround so I could keep moving forward.
 
Run your query in design mode and look what parameters you need to fill in. You have made a typo or you have deleted fields in your tables.

Guus: Have run this query and the other two it relies on maybe 100 times in design mode and it runs perfectly! This is not a parameter query.
petehilljnr: No, its not a linked table, its local.

It is now giving me a severe headache! :confused:
Any more ideas from anyone?? (where is the 'cry your eyes out' smilie?)
 
Set a breakpoint before the line is executes and run this in your immediate window.
Code:
?currentdb.querydefs("_qry_PopulateTableUnionTemp").Parameters.Count
If the number you get is higher than 0 than you could ask
Code:
?currentdb.querydefs("_qry_PopulateTableUnionTemp").Parameters(0).Name
You should get the field name that was missing.

If that doesn't work post your database or a subset showing the problem.
 

Users who are viewing this thread

Back
Top Bottom