Full Version: QBF multiple field search form question
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
kstar24
I found the attached search sample a while back. I don't remember where or when. I have managed to modify it to make it work in my DB.

My question is: Is it possible to add a 4th field in the search? For example add in zip code. I have been trying for a while with no success. Now I am not even sure if it is possible.

Any input would be appreciated.
thank you in advanced.
Kim
Daan
Hi Kim,
I like the sample, particularly in how snappy it responds.
Looking at the form's code an the query's criteria, it should be straightforward:
- In the form you copy one of both the hidden (you saw those, i hope) and visible textboxes (e.g. What Name and txtWhatName) and name them according to what else you wanna search for. (for the address for instance: What Add and txtWhatAdd )
- In the forms code you add a sub for the OnChange of the visible one of the new boxes. In the address example:
CODE
Private Sub txtWhatAdd_Change()
Me.[What Add] = Me.[txtWhatAdd].Text
DoCmd.Requery "QBF_Querysubform"
End Sub

- Then in the source query QBF_Query you follow the existing structure that you see in it's criteria. In these, for every possible combination of given criteria in the 'filter boxes' there is a line of criteria, demanding that EITHER the given text is in the table data (Add Like "*" & [Forms]![QBF_FORM]![What Add] & "*") OR there is no text given in the 'filter box' ([Forms]![QBF_FORM]![What Add])

Hope this helps some, good luck

Daan o!
kstar24
Thank you for the quick response.

What I am having trouble with is the criteria of the QBF_Query. I can't seem to get the right combinations on the criteria.

Thank you
Kim
kstar24
Daan
I wanted to let you know that the information you gave me was just enough, I finally got it to work.
Thanks
Kim
Daan
That pleases me a lot, thank you for letting me know.
Daan o!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.