Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Listbox with multiselect deleting unselected items
I have a listbox set up with the rowsource as an SQL statement creating the cursor TmpHistory. When the user double-clicks on an item, or selects multiple items and clicks on a command button, the following code fires in the MoveToActive() method of the form:
***************************************************************
LOCAL lnNumberSelected
Thisform.lblNoSelected.Caption = "Returning Records To Active......Please Wait"
lnNumberSelected = 0
For nCnt = 1 to Thisform.lstHistory.ListCount
If Thisform.lstHistory.Selected(nCnt)
lnNumberSelected = lnNumberSelected + 1
Thisform.lstActive.Additem(Thisform.lstHistory.List(nCnt))
Select tmpHistory
Go nCnt
Thisform.DeleteHistory()
Endif
EndFor
Thisform.lstHistory.Requery()
Thisform.lstActive.Requery()
***************************************************************
DeleteHistory() Method
....
deletes records matching 'cjob' and 'cver' fields in tmpHistory
....
****************************************************************
It works great most of the time but every once in a while it removes some records that it shouldn't. I don't do any removeitem statements....just a requery when all in list has been processed.
Any ideas???
Thanks.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement