General information
Category:
Forms & Form designer
Title:
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.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only