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

Filter list of transactions from as MS Query by date range 2

Status
Not open for further replies.

searlerm

MIS
Jul 28, 2001
22
0
0
GB
Hi

I am trying to setup an ODBC query where one of my source fields is "Date" and I want to be able to select a date range on which to filter the information at runtime - i.e. each time I run the query. How can I set this up so that I can enter the start & end dates of the range each time I run it?

Thanks in advance

 
Hi,

BTW, Best to use a FieldName OTHER THAN DATE since DATE is a reserve word.

This is known as a Parameter Query.

Edit the query in the MS Query Editor Grid.

If the CRITERIA is not present for DATE, Add Criteria

In the Criteria Value for DATE...
[tt]
>=[Enter Start Date]
[/tt]
and SECOND Criteria for DATE...
[tt]
<=[Enter End Date]
[/tt]


Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Just to elaborate on SKIPS response...
the expression to enter in the criteria box would read like so.

>=[Enter Start Date] AND <=[Enter End Date]


You can then redirect msquery to pick the values for these parameters from cells in your worksheet if you desire.(right click in the data that is returned) and choose parameters.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top