how do i redo a combo box lookup if a parameter is entered wrong?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • milton r
    New Member
    • Sep 2010
    • 1

    how do i redo a combo box lookup if a parameter is entered wrong?

    I have built a database where you click on the combo box lookup button and you are prompted to enter a series of queries in order to filter out the desired search result. My problem is that when I enter a wrong value in any of my parameters I get a blank result, and then I can no longer redo the search.So, how do I redo my parameter search by clicking on the lookup button again? I would really appreciate some help here. Thanks
  • MOCaseA
    New Member
    • Aug 2010
    • 34

    #2
    Please post the code you are using.

    Comment

    • MOCaseA
      New Member
      • Aug 2010
      • 34

      #3
      Here is an example of a filtering system I used:

      Code:
      Private Sub CAR_AfterUpdate()
          SetFilter
      End Sub
      Private Sub Date_AfterUpdate()
          SetFilter
      End Sub
      Private Sub System_AfterUpdate()
          SetFilter
      End Sub
      Private Sub System_POC_AfterUpdate()
          SetFilter
      End Sub
      Private Sub SetFilter()
          Dim FilterCriteria As String
          If CAR & "" <> "" Then FilterCriteria = FilterCriteria & " AND [CAR]='" & CAR & "'"
          If Date & "" <> "" Then FilterCriteria = FilterCriteria & " AND [Date]='" & Date & "'"
          If System & "" <> "" Then FilterCriteria = FilterCriteria & " AND [System]='" & System & "'"
          If System_POC & "" <> "" Then FilterCriteria = FilterCriteria & " AND [System POC]='" & System_POC & "'"
          If FilterCriteria = "" Then
                  Me.FilterOn = False
          Else
              FilterCriteria = Mid(FilterCriteria, 6) 'REMOVE THE LEADING " AND "
              Me.Filter = FilterCriteria
              Me.FilterOn = True
          End If
      End Sub
      I then made each Filter box into a combo box with the row source being the particular field that I was filtering and no control source. To keep the clutter down I also changed "SELECT" to "SELECT DISTINCT" and then selected yes in the "limit to list" option (to prevent anyone from mistyping anything. It tells the user no matching record found and stops the query until corrected). Not perfect, but functional.

      Comment

      Working...