2 Replies Latest reply on May 10, 2011 1:05 AM by RestaurantCharlie

    Calculate time between related records

    RobertGardner

      Title

      Calculate time between related records

      Post

      I have a Tests table with 3 fields:

      1. TestDate
      2. Test (specifies which test taken)
      3. Student

      A particular student may take multiple different tests, and I need to calculate the time between their most recent test and the one prior.  I've been trying the GetNthRecord function, but I can't figure out 2 things:

      1. I can pull the date from the previous record, but I cannot figure out how to write the calculation so that it returns the correct number.  (For instance, if the previous test was on the same date, it should return a zero.  It does not)
      2. The previous record is not always for the same student, and I want to calculate the difference in time between records of the same student.

      Any help would be appreciated.

      Thanks,

      Bob