List Checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amolbehl
    New Member
    • May 2007
    • 63

    List Checkbox

    Hi,

    I am loading data into a listcheckbox at form load.
    I want to make sure tht all the checkboxes in the listbox are check how do I do this


    Sub PopulateListBox ()
    Dim strSQL As String
    Dim rsRoute As Dao.Recordset
    Dim temp As Long

    strSQL = "SELECT Distinct(Item) FROM ItemsInOrder;"

    Set rsRoute = gdbFML.OpenReco rdset(strSQL, dbOpenDynaset)
    i = 0
    If Not rsRoute.EOF Then

    rsRoute.MoveFir st
    Do While Not rsRoute.EOF
    temp = rsRoute!item
    'MsgBox temp
    List1.AddItem temp, i
    rsRoute.MoveNex t
    i = i + 1
    Loop
    Else
    MsgBox "No Data available"
    Unload Me
    End If
    End Sub


    This is my subroutine which populates the listbox

    Thanx in advance
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Change ur loop :

    [code=vb]
    Do While Not rsRoute.EOF
    temp = rsRoute!item
    List1.AddItem temp, i
    List1.Selected( List1.NewIndex) = True
    rsRoute.MoveNex t
    i = i + 1
    Loop
    [/code]

    REgards
    Veena

    Comment

    • amolbehl
      New Member
      • May 2007
      • 63

      #3
      Cool thanx a lot it works

      Comment

      Working...