Listbox Question

TheSearcher

Registered User.
Local time
Today, 00:12
Joined
Jul 21, 2011
Messages
375
I have frm_NewClient which adds a new client to the database.
The controls are:
txt_Client_Id
txt_FirstName
txt_LastName
lst_Payers (This is a multiselect list box that displays different insurance carriers)

My insert query works perfectly. I am able to get the selected items from the listbox into my table.

However, I also have frm_UpdateClient which updates any client info. The controls are the same as on frm_NewClient.
My question: How do I show what payers were originally selected in my listbox? In other words, how do I show them as being selected in the listbox after my recordset returns all of the info?

Thanks in advance,
TS
 
Brilliant! Thank you very much!
I only had to use a very small snippet of code (see below). I did have to change SelectedID to string however. Also had to comment out the Exit For statement.

Code:
'****************************
  Dim varItm As Variant
  Dim SelectedID As String
  Dim i As Integer
 
  'loop the recordset
  Do While Not rs1b.EOF
    SelectedID = rs1b("Payer")
      
    For i = 0 To (lst_Payers.ListCount - 1)
       If lst_Payers.Column(0, i) = SelectedID Then
        lst_Payers.Selected(i) = True
        'Exit For
        End If
    Next i
    rs1b.MoveNext
  Loop
'**********************************************
 

Users who are viewing this thread

Back
Top Bottom