By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,320 Members | 623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,320 IT Pros & Developers. It's quick & easy.

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

P: 1
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
Sep 24 '10 #1
Share this Question
Share on Google+
2 Replies

P: 34
Please post the code you are using.
Sep 24 '10 #2

P: 34
Here is an example of a filtering system I used:

Expand|Select|Wrap|Line Numbers
  1. Private Sub CAR_AfterUpdate()
  2.     SetFilter
  3. End Sub
  4. Private Sub Date_AfterUpdate()
  5.     SetFilter
  6. End Sub
  7. Private Sub System_AfterUpdate()
  8.     SetFilter
  9. End Sub
  10. Private Sub System_POC_AfterUpdate()
  11.     SetFilter
  12. End Sub
  13. Private Sub SetFilter()
  14.     Dim FilterCriteria As String
  15.     If CAR & "" <> "" Then FilterCriteria = FilterCriteria & " AND [CAR]='" & CAR & "'"
  16.     If Date & "" <> "" Then FilterCriteria = FilterCriteria & " AND [Date]='" & Date & "'"
  17.     If System & "" <> "" Then FilterCriteria = FilterCriteria & " AND [System]='" & System & "'"
  18.     If System_POC & "" <> "" Then FilterCriteria = FilterCriteria & " AND [System POC]='" & System_POC & "'"
  19.     If FilterCriteria = "" Then
  20.             Me.FilterOn = False
  21.     Else
  22.         FilterCriteria = Mid(FilterCriteria, 6) 'REMOVE THE LEADING " AND "
  23.         Me.Filter = FilterCriteria
  24.         Me.FilterOn = True
  25.     End If
  26. 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.
Sep 24 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.