Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2002
    Posts
    192

    Unanswered: Listbox Controls

    I am trying to access a list box multiple times but can only access it once. Anyone offer some insight? I suspect that there is no way to ByVal it and/or that I have moved to the end of selected items. If it is the last one how do i get to the beginning of the selected list again?

    Public Sub Main ()
    dim ctlTest as Control
    Set ctlTest = lstTest ' The name of the list box.
    Pro1 ctlTest

    Set ctlTest = lstTest ' tried with and without this line.
    Pro2 ctlTest ' Screws up here at this line. Says Object not set.

    End Sub

    Public Sub Pro1(ByVal l_Control as Control) ' Tried with and w/o ByVal
    ' there is code here that loops through each item selected
    ' Til the end of all selected items.
    ' Works fine at this point
    End Sub

    Public Sub Pro2 (ByVal l_Control as Control) ' Tried with and w/o ByVal
    ' there is code here that loops through each item selected
    ' Til the end of all selected items.
    End Sub

  2. #2
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    I assume you are looping using a recordset.

    What is the scope of that recordset? In other words, where are you dimensioning the recordset?

  3. #3
    Join Date
    Mar 2002
    Posts
    192
    The list box is bound to a recordset. The user uses the list box to select say items 3, 5, and 8 out of 20 items. In an indirect way i am looping through a recordset. In my code the part that loops goes something like this.. and this part works the first time only.

    dim VarItem as variant

    For each VarItem in LstMyListBox
    ' Code to read in the selected item
    Next VarItem

  4. #4
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    Is this in Access, or VB?

    Are you using these routines with multiple comboboxes?

    Can you post the actual code in each of these routines?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •