Retrieve First and Last record from a query used on one form

K

Kou Vang

The query has values by date and time. I want to be able to allow the user
to view the first date and time and the last date and time, and determine a
24 or 48 hour interval to run another query by what the user selects, but I
am having trouble with the data coming from one query, and the [DATE] field
can only be sorted either Ascending or Descending. How do I get around this?
Show a first and last, but from the same field, from the same query?
Possible?
 
S

Sprinks

Kou,

You could include another subform sorted in the opposite direction, or if
the user just needs to see the min and max values, you could use a UNION
query to display them:

SELECT TOP 1 YourTable.YourDateField
FROM [YourTable]
ORDER BY YourTable.YourDateField DESC;
UNION
SELECT TOP 1 YourTable.YourDateField
FROM [YourTable]
ORDER BY YourTable.YourDateField;

Sprinks
 
Top