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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Based on Form

Status
Not open for further replies.

bhansen

IS-IT--Management
Mar 14, 2002
53
CA
I have a query that grabs it's criteria from text boxes on a form, but if the form does not have a value in the text box I want it to basically be null on the query and not filter out the data.

I'm thinking I need some kind of expression in my query field that basically says " If null then any value else use text from form " but I do not no how to this.

Thanks
 
Its sounds like u need a table to hold that info.

What kinda of info would be input onto a form, that u dont have a field for in a table?
 
I only use the form to enter the criteria for my query. I have a command button that I hit after entering the value's to run the query.
 
After you build the criteria from the textboxes, do you open another form to display the results of the query? You can dynamically build the filter for the query but you need to explain more what the flow is so the easiest solution can be derived.
 
Bhansen: Your criteria should look like this:

=Like forms!yourform!YourTextBox & "*"

TextBox is blank - all records pass
TextBox has stuff = specific records pass

Jim




There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
Wildhare
I have tried this, but still return no values
[Forms]![SEARCH]![SURNAME] & "*"

CMM
I fill in the fields I want to search by and and then click a command button that opens the query.
 
Bhansen :

With the LIKE operator in front?

LIKE [Forms]![SEARCH]![SURNAME] & "*"

??? That should work - it's straight out of a SmartAccess newsletter of about a year or so ago...

There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top