Results 1 to 3 of 3
  1. #1
    Pfaff is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    2

    Return Last Record in Database

    Greetings,



    I have a database which stores forecast data for the last 18 months. Each forecast created shows data for each item over the next 18 months. Any given month may show up to 18 different data points from the 18 different forecasts. For example:

    ItemID Forecast_On ForecastQty Month
    Item1 7/1/2014 9500 10/1/2014
    Item1 8/1/2014 10000 10/1/2014
    Item1 9/1/2014 9700 10/1/2014
    Item2 7/1/2014 2450 10/1/2014
    Item2 8/1/2014 2600 10/1/2014
    Item2 9/1/2014 2900 10/1/2014

    The query I run will show every record, which is fine for a waterfall forecast, where I can see how much the forecast has changed over time, but I want to create a query where it returns only the forecast from the most recent "Forecast_On" date, otherwise known as the "Final Forecast".

    I hope my question is clear enough. I would love some feedback on this.

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Try:

    SELECT TOP 1 * FROM tablename ORDER BY Forecast_On DESC;

    That should return the two 9/1/2014 records.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Pfaff is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Posts
    2
    Thank you June7. That worked perfectly.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-23-2013, 01:32 PM
  2. Replies: 7
    Last Post: 04-30-2012, 03:21 PM
  3. Requery and return to same record
    By tylerg11 in forum Forms
    Replies: 3
    Last Post: 04-05-2012, 11:51 AM
  4. VBA Return to the selected record
    By devcon in forum Forms
    Replies: 7
    Last Post: 02-17-2012, 09:17 AM
  5. Return Record # In Query
    By redwinger354 in forum Access
    Replies: 1
    Last Post: 09-15-2007, 01:08 PM

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