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

"Question" query with variable input

Status
Not open for further replies.

BYarn

MIS
Jul 20, 1999
131
0
0
US
I regularly use queries that prompt with a question, like "What is the date". The query runs with the variable and returns records based on what your typed.
That works fine until you want to want to enter more than one variable. Also if you use the criteria box to specify one specific criteria to have filter only-like > 5/1/2006 in a date column returns files with dates beginning after 5/1/06
The problem- what if you want to prompt with a question for a range of information. EG- dates between 5/1/06 and 5/20/06 or just 5/1 and 5/20. The query runs but I can't enter anything but a single item- 5/1/06 but not > 5/1/06

ANy ideas??? THANKS!!
 
It is nearly always best to use a form for criteria. You can the change the result as you require.
 
Hi!

On the criteria line in the query design view you use:

Between [Enter Start Date] And [Enter End Date]

Or

>= [Enter Start Date]

etc.

You will have to make a query for every possibility you want to provide, unless you want to use VBA to build the queries on the fly.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Or use a form. :)

[tt]============================
Pick From : <, >, Between
Enter date 1 :
Enter date 2 :

Text For Criteria : <Built from above>
============================[/tt]

Criteria in query:
=Forms!CriteriaDialog![Text For Criteria]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top