Run-time error '3061'

TheLazyEngineer

New member
Local time
Today, 02:02
Joined
Mar 3, 2015
Messages
3
So I got some help here before for a runtime error that I was getting, well I'm back... now with a different error, after fixing a few others ones. I have no idea what this means. HELP please.
(picture is attached I can't paste for some reason)
I have attached the actual access file if you would like to open it and check it out. The problem is with the "add" button, that adds the data I input into the table below it.
"Run-time error '3061':
Too few parameters. Expected 1."
The error reads as you can see.
Here is the code:
--------------------------------------------------------------------------

Private Sub cmdAdd_Click()
'add data to table
CurrentDb.Execute "INSERT INTO PROGRAM(programid, robotnumber, robot, box, options, origrom, [date], disk, customer) VALUES (" & Me.txtNumber & ",'" & Me.txtRobot & "','" & _
Me.txtBox & "', '" & Me.txtOptions & "', '" & Me.txtID & "', '" & Me.txtRom & "', '" & Me.txtDate & _
"', '" & Me.txtDisk & "', '" & Me.txtCustomer & "')"
'refresh data in list on form
frmProgramSub.Form.Requery

End Sub

Private Sub cmdClear_Click()
Me.txtNumber = ""
Me.txtRobot = ""
Me.txtBox = ""
Me.txtOptions = ""
Me.txtRom = ""
Me.txtDisk = ""
Me.txtCustomer = ""
Me.txtDate = ""

Me.txtID.SetFocus
End Sub

Private Sub cmdClose_Click()
DoCmd.Close

End Sub

--------------------------------------------------------------------------
Here is the attached file. Any help would be appreciated. Thanks.
 

Attachments

  • Untitled.png
    Untitled.png
    43.2 KB · Views: 139
  • Database1111.zip
    Database1111.zip
    146 KB · Views: 121
1. You are doing too much in one go. Make a stringwith the Sql so you can check what is produced like so: http://www.baldyweb.com/immediatewindow.htm

2. Date is a lousy name for a field. Here is a list of restricted words: http://allenbrowne.com/AppIssueBadWord.html

3."Clearing" controls by setting them to "" is bad practice for controls containing other data type than text. Use Null

4. Declaring/using date as string is really a bad idea too. Dates have their own special format. Look it up in the documentation.

You can find more on error 3061 in Similar threads at the bottom. Typos cause it often. Or references to forms (not in this case).
 

Users who are viewing this thread

Back
Top Bottom