Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SOME PROBLEM WITH LISTBOXES .. SAVING RECORDS

Status
Not open for further replies.

rbasram

Programmer
Sep 27, 2001
53
CA
I have two list boxes and I want to loop through both the list boxes at the same time to save a record in a new table. I have truied to do with one of the listboxes but i am confused how do i increment the other list box's count. Some of my code is below




Private Sub Command21_Click()
Dim lrsMyRecordSet As Recordset

Dim liLoop As Variant

Set lrsMyRecordSet = CurrentDb.OpenRecordset("test", dbOpenDynaset)

For liLoop = 0 To lstAllProduct.ListCount - 1
'HOW DO I REFERENCE TWO LISTBOX HERE...

lstAllProduct.Selected(liLoop) = True
lrsMyRecordSet.AddNew
lrsMyRecordSet("Pt") = Me.lstAllProduct.Column(0, liLoop)
'HERE IS WHERE I WANT THE CONTENTS OF MY SECOND LIST BOX TO BE SAVED AT THE SAME TIME
lrsMyRecordSet("CT#") = Me.[txtCTracking]
lrsMyRecordSet("T#") = Me.[Tracking#]
lrsMyRecordSet("Pub#") = Me.[Publication#]
lrsMyRecordSet("Tit") = Me.[txtTitle]
lrsMyRecordSet("DID") = Me.[txtDocumentID]
lrsMyRecordSet("AID") = Me.[txtAuthorName]
lrsMyRecordSet.Update

Next liLoop

End Sub
 
I figured it out I just added a line

lrsMyRecordSet("some") = Me.2ndListProduct.Column(0, liLoop)

Only the counter gets incremented.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top