Multiple criteria from same fileld with combos in Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • giakoumidakis
    New Member
    • Feb 2016
    • 1

    Multiple criteria from same fileld with combos in Form

    Hi all. I^m trying to create a form in my customers database to display results by selecting values from combos or list boxes. The sample DB found in allen browne http://allenbrowne.com/ser-62.html website and I really like it. What I would like to do though is have the following.

    <<<<This is the code for one combo.>>>> <<<<<<
    Code:
    'Number field example. Do not add the extra quotes.
      If Not IsNull(Me.cboFilterLevel) Then
            strWhere = strWhere & "([LevelID] = " & Me.cboFilterLevel & ") AND "
      End If
    >>>>>>
    I would like to have more than one combos like.
    
    <<<<<<
    'Number field example. Do not add the extra quotes.
      If Not IsNull(Me.cboFilterLevel1) Then
            strWhere = strWhere & "([LevelID] = " & Me.cboFilterLevel1 & ") AND "
      End If
      If Not IsNull(Me.cboFilterLevel2) Then
            strWhere = strWhere & "([LevelID] = " & Me.cboFilterLevel2 & ") AND "
      End If
      If Not IsNull(Me.cboFilterLevel3) Then
            strWhere = strWhere & "([LevelID] = " & Me.cboFilterLevel3 & ") AND "
      End If
      If Not IsNull(Me.cboFilterLevel4) Then
            strWhere = strWhere & "([LevelID] = " & Me.cboFilterLevel4 & ") AND "
      End If
    >>>>>>
    I've inserted the code but is working only for one combo at the time.
    Any suggestions are more than welcome and much appreciated.
    Cheers.
    Last edited by Rabbit; Feb 24 '16, 04:47 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    It's really not a great idea to express your question simply as code. An actual question written in English is far preferable.

    However, if I do understand you correctly, you're after handling multi-field filtering using multiple ComboBoxes. This can be either cascaded (where one selection affects the contents of other ComboBoxes) or not. You should find what you're after in Cascaded Form Filtering or Example Filtering on a Form.

    Comment

    • mbizup
      New Member
      • Jun 2015
      • 80

      #3
      You've posted this question on at least one other forum... You might find that you get more targeted responses by posting in one place, and responding promplty to the people trying to help (ie: collaborate!).

      Comment

      Working...