Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search Function with multiple Options

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
I have a form. Originally, user would enter a keyword in a text box on the form, and the form would refresh displaying all records with that keyword.
I want to refine it more and have 3 options on the form: Server, Volume, Rights.
The user would select one of those three, then enter a keyword and records would be displayed based on that option.
Right now, my form is based off a query that (under the Server Field Criteria) has:
Like "*" & [forms]![frmNovellSearch].[txtSearchWord] & "*"

This returns all keywords found under the server field.
How would I write that query so it does it for whichever field the user selects on the form?

Right now I have:
IIf(([forms]![frmNovellSearch].[optServer])=False,([Dir_Trustees].[Server]),(Like "*" & [forms]![frmNovellSearch].[txtSearchWord] & "*"))

And I have that under each of the 3 fields in the query (of course I've changed the field names), but it doesn't work.
Anyone know how to make this work? I thought I had it working, but no cigar. Any ideas? Suggestions?

Thanks.
 
In the criteria cell of Server
Like "*" & [Forms]![frmNovellSearch]![txtSearchWord] & "*" OR [Forms]![frmNovellSearch]![optServer]=False

And similar stuff in the 2 others.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top