3061 Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is driving me crazy, I know its probably right infront of me but i cant
find it:
I keep getting 3061 too few parameters, expected 1

u1 = "UPDATE tempMeeting SET tempMeeting.ysnDist = True " & _
"WHERE ((([Forms]![frmMeeting2].[chk1])=True) AND
((tempMeeting.Dist)='1'));"


-Matt
 
Copy and paste your SQL into a new query in the database window and try to
execute it from there. It should prompt you for the parameter. The name of
the parameter in the prompt should be a clue to what the problem is.

Some things to check for:

1) Misspellings. If you've misspelled something, the query interpreter will
assume the item to be a parameter since it can't find it or recognize it.

2) Is frmMeeting2 open and available to be read?

Be aware that this will only check the value of chk1 for the current record
on frmMeeting2.
 
Its weird, this works fine when I paste it into a blank query, but it just
doesn't work in vba.

Wayne Morgan said:
Copy and paste your SQL into a new query in the database window and try to
execute it from there. It should prompt you for the parameter. The name of
the parameter in the prompt should be a clue to what the problem is.

Some things to check for:

1) Misspellings. If you've misspelled something, the query interpreter will
assume the item to be a parameter since it can't find it or recognize it.

2) Is frmMeeting2 open and available to be read?

Be aware that this will only check the value of chk1 for the current record
on frmMeeting2.

--
Wayne Morgan
MS Access MVP


Matt said:
This is driving me crazy, I know its probably right infront of me but i
cant
find it:
I keep getting 3061 too few parameters, expected 1

u1 = "UPDATE tempMeeting SET tempMeeting.ysnDist = True " & _
"WHERE ((([Forms]![frmMeeting2].[chk1])=True) AND
((tempMeeting.Dist)='1'));"
 
In that case, before you execute it, use a Debug.Print statement to print
the text to the Immediate window so that you can see what is actually trying
to execute.

Debug.Print u1

Also, what is the command line you're using to execute the SQL?
 
Wayne,

When I ran the code in the immediate window, the result was "False".

Here is my code:

Dim u1 As String
u1 = "UPDATE [tempMeeting] SET [tempMeeting].[ysnDist] = True " & _
"WHERE ((([Forms]![frmMeeting2].[chk1])=True) AND
(([tempMeeting].[Dist])='1'));"

CurrentDb.Execute u1

This repeats for u2 through u32 (multiple check boxes in the form)
I'm using this same setup for multiple forms and it works perfectly fine in
those forms.

Thanks,
-Matt
 
But what did the "Debug.Print u1" return? You would place that line just
before your "CurrentDb.Execute u1". Also, I recommend that you change this
line to

CurrentDb.Execute u1, dbFailOnError

This may return an error message that will help diagnose the problem.
-------------------Modified-------------------------------
Dim u1 As String
u1 = "UPDATE [tempMeeting] SET [tempMeeting].[ysnDist] = True " & _
"WHERE ((([Forms]![frmMeeting2].[chk1])=True) AND
(([tempMeeting].[Dist])='1'));"
Debug.Print u1 'This will put the contents of u1 in the Immediate window
CurrentDb.Execute u1, dbFailOnError

--
Wayne Morgan
MS Access MVP


Matt said:
Wayne,

When I ran the code in the immediate window, the result was "False".

Here is my code:

Dim u1 As String
u1 = "UPDATE [tempMeeting] SET [tempMeeting].[ysnDist] = True " & _
"WHERE ((([Forms]![frmMeeting2].[chk1])=True) AND
(([tempMeeting].[Dist])='1'));"

CurrentDb.Execute u1

This repeats for u2 through u32 (multiple check boxes in the form)
I'm using this same setup for multiple forms and it works perfectly fine
in
those forms.

Thanks,
-Matt


Wayne Morgan said:
In that case, before you execute it, use a Debug.Print statement to print
the text to the Immediate window so that you can see what is actually
trying
to execute.

Debug.Print u1

Also, what is the command line you're using to execute the SQL?
 

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
Error 3061 2
Error 3061 1
3061 Query Error 3
Error 3061 when running update query from code 3
Run-time error 3061. Too Few Parameters. Expected 2. 2
SQL error 2
error 3061 1

Back
Top