Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

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

Discussion in 'Information Technology' started by Kou Vang, Nov 1, 2005.

  1. Kou Vang

    Kou Vang
    Expand Collapse
    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?
     
  2. Loading...

    Similar Threads Forum Date
    USA Obama: U.S. Will Help New Governments Retrieve Assets Breaking News May 19, 2011
    Sikh News New Orleans: Sikh holy book retrieved (Rediff.com) Breaking News Sep 11, 2005
    Sikh News Sikh holy book retrieved from under water (Hindustan Times) Breaking News Sep 10, 2005
    Last Blog Blogs Oct 14, 2016
    That Pesky Last 1% Blogs Oct 12, 2016

  3. Sprinks

    Sprinks
    Expand Collapse
    Guest

    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

    "Kou Vang" wrote:

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

Share This Page