Easy Microsoft Access/VB question

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

  1. Sanchez

    Sanchez OSNN Junior Addict

    Messages:
    14
    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.
    :eek:
     
  2. XPos

    XPos OSNN Addict

    Messages:
    88
    Location:
    Kansas
    This will test the list box.

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