O
Olu Solaru
Scenario,
I am trying to append the contents of my listbox to a particular table.
I keep getting the following error message: Run Time Error '3265'
Item not found in Collection.
Code
Private Sub btnSubmit_Click()
Set rs = CurrentDb.OpenRecordset("tblLotNumber")
rs.AddNew
rs!ProcessDate = Me.ProcessDate
rs!LotNumber = Me.txtLotNumber
For intCount = 1 To lstSops.ListCount
*****Problem Line rs.Fields("Sop" & Format(intCount, "00")) =
Me.lstSops.ItemData(intCount - 1) = ""*******
Next intCount
rs.Update
MsgBox ("Lot Number " & Me.txtLotNumber & " was successfully added")
Me.lstSops.RowSource = ""
End Sub
This code worked on another form that has a listbox, but in that instance
all the fields being appended to were named Sop01, Sop02.....Sop10.
But with this Listbox, I have some other fields named BPrNumber, Area, that
are being appended to, this is where my problem lies ...I think.
N.B. BRPNumber is an alphanumeric field.
I am trying to append the contents of my listbox to a particular table.
I keep getting the following error message: Run Time Error '3265'
Item not found in Collection.
Code
Private Sub btnSubmit_Click()
Set rs = CurrentDb.OpenRecordset("tblLotNumber")
rs.AddNew
rs!ProcessDate = Me.ProcessDate
rs!LotNumber = Me.txtLotNumber
For intCount = 1 To lstSops.ListCount
*****Problem Line rs.Fields("Sop" & Format(intCount, "00")) =
Me.lstSops.ItemData(intCount - 1) = ""*******
Next intCount
rs.Update
MsgBox ("Lot Number " & Me.txtLotNumber & " was successfully added")
Me.lstSops.RowSource = ""
End Sub
This code worked on another form that has a listbox, but in that instance
all the fields being appended to were named Sop01, Sop02.....Sop10.
But with this Listbox, I have some other fields named BPrNumber, Area, that
are being appended to, this is where my problem lies ...I think.
N.B. BRPNumber is an alphanumeric field.