List Box w/ cancel all cmd button

July 30, 2010 at 11:19:09
Specs: Windows XP
I have two sets of list boxes the first set works fine but the second set does not., In the second set you can add text from one into the other using add/remove cmd button. I have a cancel all cmd button that i want to be able to clear the second listbox and reload all the text choices into the first list box. i already have some code but i am not sure what is wrong with it.

Private Sub cmdClearAll_Click()
Dim ctl As Control
Dim rs As New ADODB.Recordset
Dim sQry As String

lstAvailStatusS.Clear
lstSelectedStatusS.Clear
sQry = "SELECT * FROM vList WHERE ListName = 'InsuranceServiceStatus'"
rs.Open sQry, m_Conn, adOpenStatic, adLockOptimistic

If rs.RecordCount < 1 Then Exit Sub
rs.MoveFirst

Do While Not rs.eof
lstAvailStatusS.AddItem rs!ListText
lstAvailStatusS.ItemData(lstAvailStatusS.NewIndex) = rs!ListValue
rs.MoveNext
Loop


lstAvailStatusP.Clear
lstSelectedStatusP.Clear
sQry = "SELECT * FROM vList WHERE ListName = 'PatientCategory'"
rs.Open sQry, m_Conn, adOpenStatic, adLockOptimistic

If rs.RecordCount < 1 Then Exit Sub
rs.MoveFirst

Do While Not rs.eof
lstAvailStatusP.AddItem rs!ListText
lstAvailStatusP.ItemData(lstAvailStatusP.NewIndex) = rs!ListValue
rs.MoveNext
Loop
End Sub


See More: List Box w/ cancel all cmd button

Report •

#1
August 1, 2010 at 14:11:22
Okay. What's it doing?

Report •
Related Solutions


Ask Question