Results 1 to 2 of 2
  1. #1

    Referencing a previous record

    Is there a way to reference a previous row using a query? I am using Access 2000 SR2.

    I have a log table in Access which contains a date/time field which is written on a start/end event. I need to know the time that the event took. I take the start of the next event as the end of the previous event i.e. RunTime = Logtime(i) - Logtime(i-1). I need this to be in SQL if possible since the table is read by an external program. I then total the different event totals to get an idea what activities the machine did during the day.

    I presently run a VB app to do this which is time consuming since it must be run every 15 minutes to keep the log results current.


  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Referencing a previous record

    Your best bet is to redesign the table to include an end time. SQL doesn't know how to do the previous value. The previous value depends on sort orders and they're subject to change without notice.

Posting Permissions

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