Results 1 to 6 of 6
  1. #1
    bigdan5428 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    4

    Trouble Finding "Oldest" Data


    I will try my best to describe my situation. I have a table with 4 colums: Date, Equipment, x, and y. "X and Y" don't matter for this problem. The table is a history of a certain part change for each piece of equipment. What I am wanting to do is look at each equipment name (there are 12 at this time) and find the most recent date for the part change on each. Given that information, I want to calculate which of those values is the oldest. Basically, given the history, I'm wanting to know which piece of equipment has had the longest amount of time go by without the part change. Any help to lead me in the right direction would be appreciated.

  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,521
    The first query here should find the most recent for each:

    http://www.baldyweb.com/LastValue.htm

    You can add the DateDiff() and Date() functions on the result to find the oldest.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    bigdan5428 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    4
    SQL for first query works exactly as I wanted! Thank You! After looking at the 2nd part of the page, I was interested to try that as well. I am unfamiliar with the "INNER JOIN" command. I get an syntax error in the JOIN function. I changed all your table names, fields, queries to match my application but I still am getting a snytax error in the JOIN function.

  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,521
    Hard to say without seeing your query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    bigdan5428 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    4
    Must have had a comma in the wrong place or something, tried it again from scratch, working this time. Thanks so much for your help!!

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

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

Similar Threads

  1. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  2. Replies: 4
    Last Post: 03-23-2012, 01:18 PM
  3. Need help finding "New" patients
    By mkfloque in forum Access
    Replies: 11
    Last Post: 01-11-2012, 01:31 PM
  4. Replies: 16
    Last Post: 07-22-2011, 09:23 AM
  5. Replies: 3
    Last Post: 08-10-2010, 02:12 PM

Tags for this Thread

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