Results 1 to 5 of 5
  1. #1
    ChuckM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    3

    Query Last Two Entries for each Vehicle to Determine Difference in Mileage

    Hello,

    I have a vehicle database that I am suppose to receive daily inspections for every vehicle. The table for the daily inspections records "Entry Key" (primary key), "Asset Key", "Inspection Date", "Reported By", "Mileage", "Hrs Engine", "Hrs PTO", and "Hrs Battery" of each vehicle. What I have been asked to do is create a report that will show the difference in date, mileage and hours from the last two entries. I do not receive inspections every day like I am supposed to.

    Does anyone know of a way to accomplish this?

    Thanks,


    Chuck Murphy

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    See if this helps:

    http://allenbrowne.com/subquery-01.html#AnotherRecord

    You might like the one underneath too.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ChuckM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    3
    Thank you very much pbaldy. The second example was just what I needed.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ChuckM is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    3
    Well, take that back. I now have a query with data for the last two entries on each vehicle. But I do not know how to separate the data (so I can create a last query and a previous to last query)...or calculate the data from the same query.

    Hope that makes sense.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-18-2013, 03:14 PM
  2. Vehicle Mileage Database
    By Mtyetti2 in forum Access
    Replies: 6
    Last Post: 10-07-2013, 01:50 PM
  3. Vehicle Mileage
    By Mtyetti2 in forum Forms
    Replies: 5
    Last Post: 02-16-2013, 08:23 AM
  4. Mileage App
    By neo651 in forum Access
    Replies: 1
    Last Post: 06-01-2012, 03:29 PM
  5. How do I determine a SQL query result?
    By Trainman in forum Database Design
    Replies: 1
    Last Post: 10-15-2009, 04:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums