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

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

Guest

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?
 
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
 

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

Back
Top