upper and lower limit function. "BETWEEN.....AND....."

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My Table has Few Fields two of them hold dates. the two date fileds are
"FROM" and the other is "TO". I want to be able to run a query that will
bring me back the upper limit from the "FROM" field and the lower limit from
the "TO" Field.

I was wondering if there is a way to use the "between...and..." function on
two different fields.

Thank you
 
I think what you are looking for is:

Undert the From field, in the criteria section write
= [Enter From Date]

Undert the To field, in the criteria section write

<= [Enter To Date]

Or, InSQL
Select * From TableName Where FromDateField >= [Enter From Date] And
ToDateField <= [Enter To Date]

==============
The user will be prompt to enter to dates and the records will be between
this two dates
 
Firstly FROM and TO are both reserved words in queries, so you may get
problems with Access understanding the query. For an extended list of the
words to avoid, see:
http://allenbrowne.com/AppIssueBadWord.html

You can most recent date in a field in a query by depressing the Totals
button on the toolbar, and choosing Max under that field. Similarly use Min
under a date field to get the oldest date.

To get those values and then use them elsewhere in the query, you would
either need to save the first query and use it as an input "table", or else
use a subquery. If subqueries are new, see:
http://allenbrowne.com/subquery-01.html
 
Back
Top