I have a functiona that loop through a listbox and then adds a new the record into the table but after this procedure i get an extra blank record i have no idea why any suggetions...
Private Sub Command19_Click()
Dim lrsMyRecordSet As Recordset
Dim liLoop As Variant
Set lrsMyRecordSet = CurrentDb.OpenRecordset("test", dbOpenDynaset)
For liLoop = 0 To lstAllProduct.ListCount
lstAllProduct.Selected(liLoop) = True
lrsMyRecordSet.AddNew
lrsMyRecordSet("Pt" = Me.lstAllProduct.Column(0, liLoop)
lrsMyRecordSet("CT#" = Me.[txtCTracking]
lrsMyRecordSet("T#" = Me.[Tracking#]
lrsMyRecordSet("Pub#" = Me.[Publication#]
lrsMyRecordSet!Tt = Me.[txtTitle]
lrsMyRecordSet!DID = txtDocumentID
lrsMyRecordSet!AID = Me.txtAuthorName
lrsMyRecordSet.Update
Next liLoop
End Sub
Private Sub Command19_Click()
Dim lrsMyRecordSet As Recordset
Dim liLoop As Variant
Set lrsMyRecordSet = CurrentDb.OpenRecordset("test", dbOpenDynaset)
For liLoop = 0 To lstAllProduct.ListCount
lstAllProduct.Selected(liLoop) = True
lrsMyRecordSet.AddNew
lrsMyRecordSet("Pt" = Me.lstAllProduct.Column(0, liLoop)
lrsMyRecordSet("CT#" = Me.[txtCTracking]
lrsMyRecordSet("T#" = Me.[Tracking#]
lrsMyRecordSet("Pub#" = Me.[Publication#]
lrsMyRecordSet!Tt = Me.[txtTitle]
lrsMyRecordSet!DID = txtDocumentID
lrsMyRecordSet!AID = Me.txtAuthorName
lrsMyRecordSet.Update
Next liLoop
End Sub