Appending contents of a list box to a database

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top