Easy Microsoft Access/VB question

Discussion in 'Web Design & Coding' started by Sanchez, Jun 8, 2004.

  1. Sanchez

    Sanchez OSNN Junior Addict

    I have a combo box in a form and I want to search it for certain strings. Right now I'm only doing

    If Me.Combo0.text = "hello" then whatever...

    But that only tests the text that is currently selected. How would I test every entry in the combo box to see if any entry was "hello".

    If I can't test everything in the combo box how can I check every entry in the column of the table that the combo box is based on.

    Thanks. You guys rock.
  2. XPos

    XPos OSNN Addict

    This will test the list box.

    Dim I as Integer
    For I = 0 to Combo.ListCount - 1
       if Combo.List(I) = "Hello" then
          Exit For
       End If
    Next I