Query from a Form

  • Thread starter gymcshoe via AccessMonster.com
  • Start date
G

gymcshoe via AccessMonster.com

I'm trying to build a query that pulls information from a form

On the form, there's a text box that I would like the user to type in "<3000"

for example. How do I build the query to pull this in as a criteria?

For Example If the user types in "<3000" into the revenue text box,
I want all records that have less than 3000 in revenue to be shown. similarly,
if the user decides to look for records with <500 in revenue, if they type in
"<500" then records with less than 500 revenue will be shown. If the user
does not type in anything, then I want all records to be shown. Thanks

This alone does not work: [Forms]![Form3]![Revenue]

I get the this expression is typed incorrectly or is too complicated error.

Thanks again for the help
 
A

akphidelt

In order to do what you want to do you would need to use VBA and SQL
statements I think. However there is an alternative... for example

On your form create 2 text boxes... 1 called min and 1 called max.

In your query under the criteria write

Between Forms!yourform!txtMin And Forms!yourform!txtMax

You can even set the default values to 0 and 100000 or whatever a good max
is that will show all the data.

Also if all you need is less then statements in the query criteria write
< Forms!yourform!Revenue

And underneath that write

Forms!yourform!Revenue Is Null

This will show all the data if the Revenue is left blank and then show all
the data less then whatever is typed in the box.

Hope this helps.
 
G

gymcshoe via AccessMonster.com

Thanks akphidelt! That worked out great! (using the min/max method)

thanks everyone for helping out!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top