Y
yator
I am trying to use a List Box ("LstDefs")to add a record to a subform. The
List Box is on the Main Form.
I receive a Compile Error: "Method or data member not found" at Me.EventNo ?
If I eliminate the EventNo field I receive the error at Me.LstDefs.Columns.
Private Sub cmdAdd_Selected_Click()
On Error GoTo Err_cmdAdd_Selected_Click
Dim varItem As Variant
Dim strSQL As String
For Each varItem In Me.LstDefs.ItemsSelected
strSQL = " INSERT INTO tbl_IDQ_event_defs (EventNo, DefNo) " _
& "VALUES (" & Me.EventNo & "," _
& Me.LstDefs.Columns(0, varItem) & ")"
CurrentDb.Execute strSQL, dbFailOnError
Next
Me.frmHAI_sub_event_defs.Form.Requery
Exit_cmdAdd_Selected_Click:
Exit Sub
Err_cmdAdd_Selected_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Selected_Click
End Sub
List Box is on the Main Form.
I receive a Compile Error: "Method or data member not found" at Me.EventNo ?
If I eliminate the EventNo field I receive the error at Me.LstDefs.Columns.
Private Sub cmdAdd_Selected_Click()
On Error GoTo Err_cmdAdd_Selected_Click
Dim varItem As Variant
Dim strSQL As String
For Each varItem In Me.LstDefs.ItemsSelected
strSQL = " INSERT INTO tbl_IDQ_event_defs (EventNo, DefNo) " _
& "VALUES (" & Me.EventNo & "," _
& Me.LstDefs.Columns(0, varItem) & ")"
CurrentDb.Execute strSQL, dbFailOnError
Next
Me.frmHAI_sub_event_defs.Form.Requery
Exit_cmdAdd_Selected_Click:
Exit Sub
Err_cmdAdd_Selected_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Selected_Click
End Sub