G
Guest
When I try to select any objects in the list box, I get this error message:
Unable to Update
Error 3061: Too few parameters. Expected 1
This is in the After Update of the list box.
Public Sub List31_AfterUpdate()
On Error GoTo Err_List31_AfterUpdate
Dim db As Database
Dim ws As Workspace
Dim strSQL As String
Dim blnInTransaction As Boolean
Dim varItem As Variant
Dim strtable As String
Dim strvar As String
' Make sure the current member record has been saved.
If Me.Dirty Then Me.Dirty = False
Set ws = Workspaces(0)
Set db = ws.Databases(0)
ws.BeginTrans
blnInTransaction = True
strtable = "itblPRODUCT_ANSWERS"
strvar = "txtproduct_no"
' Add each hobby selected in the list box.
With Me.List31
For Each varItem In .ItemsSelected
'change this
strSQL = _
"INSERT INTO " & strtable & " (txtEVENT_ID, " & strvar & ")
VALUES (" & _
Me.autEVENTID & ", " & .ItemData(varItem) & ")"
db.Execute strSQL, dbFailOnError
Next varItem
End With
ws.CommitTrans
blnInTransaction = False
Exit_List31_AfterUpdate:
Set db = Nothing
Set ws = Nothing
Exit Sub
Err_List31_AfterUpdate:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbExclamation, _
"Unable to Update"
If blnInTransaction Then
ws.Rollback
blnInTransaction = False
End If
Resume Exit_List31_AfterUpdate
End Sub
Unable to Update
Error 3061: Too few parameters. Expected 1
This is in the After Update of the list box.
Public Sub List31_AfterUpdate()
On Error GoTo Err_List31_AfterUpdate
Dim db As Database
Dim ws As Workspace
Dim strSQL As String
Dim blnInTransaction As Boolean
Dim varItem As Variant
Dim strtable As String
Dim strvar As String
' Make sure the current member record has been saved.
If Me.Dirty Then Me.Dirty = False
Set ws = Workspaces(0)
Set db = ws.Databases(0)
ws.BeginTrans
blnInTransaction = True
strtable = "itblPRODUCT_ANSWERS"
strvar = "txtproduct_no"
' Add each hobby selected in the list box.
With Me.List31
For Each varItem In .ItemsSelected
'change this
strSQL = _
"INSERT INTO " & strtable & " (txtEVENT_ID, " & strvar & ")
VALUES (" & _
Me.autEVENTID & ", " & .ItemData(varItem) & ")"
db.Execute strSQL, dbFailOnError
Next varItem
End With
ws.CommitTrans
blnInTransaction = False
Exit_List31_AfterUpdate:
Set db = Nothing
Set ws = Nothing
Exit Sub
Err_List31_AfterUpdate:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbExclamation, _
"Unable to Update"
If blnInTransaction Then
ws.Rollback
blnInTransaction = False
End If
Resume Exit_List31_AfterUpdate
End Sub