Solved Runtime error '3061' too few parameters .expected 1 (1 Viewer)

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:01
Joined
Oct 29, 2018
Messages
21,469
no, Unfortunately . I have to run my project and stuck to this little part ...
To try it, copy and paste the code/function from the website into a Standard Module and give the module a generic name like Module1.

Then, modify your code to replace this line:

Code:
CurrentDb.Execute sVal

With this one:

Code:
fExecuteQuery sVal

Hope that helps...
 

mansied

Member
Local time
Yesterday, 19:01
Joined
Oct 15, 2020
Messages
99
Did you try the Debug.Print method? If so, what's the SQL of the failing query? You don't by chance have spaces in table names do you? If so you'll need to surround the table name in square brackets.:

"FROM [" & sVal & "]"
Yes you are right........ bracket helped ....
the code is working now .. but I don't know how !!!
I tried to test it by append query and it added a bracket for table name in SQL code !!!


I appropriate all your help and advice ...i have to study more how to debug VBA codes ....
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 16:01
Joined
Aug 30, 2003
Messages
36,125
Yes, the query design grid will add them automatically, but you have to do it yourself in code. Glad you got it working.
 

mansied

Member
Local time
Yesterday, 19:01
Joined
Oct 15, 2020
Messages
99
Did you try the Debug.Print method? If so, what's the SQL of the failing query? You don't by chance have spaces in table names do you? If so you'll need to surround the table name in square brackets.:

"FROM [" & sVal & "]"
I really appropriate that.... yes you were right,I saw that ,Access adds a [ ] for table name in the append query sql ..

my problem solve till here .
thank you very much for all helps .I have to study more about VBA debugging..
 

Users who are viewing this thread

Top Bottom