Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 3061. Too few parameters expected 1 What's wrong with my code?

Status
Not open for further replies.

sisieko

Programmer
Jun 13, 2004
56
US
I get this error when i check and uncheck my checkbox.
The checkbox is located on a form and when it's checked it's supposed to feed data into a small table.

When i click on it. I get this "Error 3061. Too few parameters expected 1" What could be wrong here?

Code:
Private Sub chkNoSupportHrs_AfterUpdate()
On Error GoTo Err_ChkBox_Click
Dim MySQL As String
    
If Me.chkNoSupportHrs Then
   '-- CheckBox going to "Checked" state
   MySQL = "Insert into tblNoSupportHrs(sID, WeekEnding)" & _
        "Values(" & Me.txtResource & ", """ & Me.Text18 & """)"
Else
   '-- CheckBox going to "UnChecked" state
   MySQL = "DELETE * FROM tblNoSupportHrs WHERE sID = " & Me.txtResource
End If

CurrentDb().Execute MySQL, dbFailOnError

Exit_ChkBox_Click:
   Exit Sub

Err_ChkBox_Click:
   MsgBox "Error No:    " & Err.Number & vbCr & _
   "Description: " & Err.Description
   Resume Exit_ChkBox_Click

End Sub

 
Provided that the tblNoSupportHrs table has a numeric field sID and a text field WeekEnding defined, you may try this:
MySQL = "INSERT INTO tblNoSupportHrs (sID, WeekEnding) VALUES " & _
[tt]"(" & Me.txtResource & ", '" & Replace(Me.Text18, "'", "''") & "')"[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top