Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Elapsed Between Timestamps

    Hello,

    I have a table with a field for date-and-time stamp. I created a query to show a subset of the table, sorted by the date-and-time stamp. Is it possible to add an expression to the query definition that will calculate the elapsed time from the previous date-and-time stamp?

    Thanks!

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Elapsed Between Timestamps

    Look at the DateDiff Function in the Help index, which returns the number of time intervals between two specified dates. Use Now() as the third argument to calculate the number of time intervals from the system date/time.

  3. #3
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Elapsed Between Timestamps

    Thanks, however the issue is still: I can refer to the date from the record in question easily enough for one of the inputs to DateDiff, but how do I refer to the date from the PREVIOUS record in the query result for the other input? I am comfortable with calculating elapsed times, I just don't know how to reference the proper inputs.

  4. #4
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Elapsed Between Timestamps

    Sorry, I did not understand that one of the date/time stamps you needed to reference was in a previous record. The only way I know how to reference a previous record is by using VB. You would create a recordset, find the record, hold the date/time value, then move to the previous record to obtain the previous record's date/time stamp. That would give you the references for the DateDiff calculation. If you like, I can post an example of VB code that moves between records to gather values or someone else may know a non-VB method to accomplish this.

  5. #5
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Elapsed Between Timestamps

    Thanks, that will not be necessary. The purpose for my question is more generic than Access, but since I am familiar with Access, I figured it would be a good test-bed.

    Thanks anyway!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •