Results 1 to 4 of 4
  1. #1
    luderbeck1 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    2

    Can't figure out Access query

    I have 2 tables. I need to be able to get the most recent item cost and from what method it was from (purchase order, credit, etc.). I get all sorts of jumbled and mixed up info. Tried Max, grouping, MostRecent and no luck. I just can't get it correct.

    Here's what I have:



    Table 1: dbo_icitem
    Fields needed: item, itmdesc, and price

    Linked with table 2 via item

    Table 2: dbo_icytrn
    Fields needed: tcost, tdate, appid (this is the filed that indicates how cost determined PO, AR, SO, IC).

    When I run the query I get multiple entries for each item because it lists the most recent entry for each appid per item. I only want one entry - the most recent regardless of appid.

    HELP!!
    Thanks

  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
    Is this what you're after?

    http://www.baldyweb.com/LastValue.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    luderbeck1 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2012
    Posts
    2
    Quote Originally Posted by pbaldy View Post
    Is this what you're after?

    http://www.baldyweb.com/LastValue.htm
    Almost. I still get multiple records for each item number because of the different costs and type of application. I just want 1 item number, the most recent date, cost, and type of application all associated to that item.


    SELECT dbo_icytrn.*
    FROM dbo_icytrn INNER JOIN qryMaxDates ON (dbo_icytrn.tdate=[qryMaxDates].MaxDate) AND (dbo_icytrn.Item=[qryMaxDates].Item);

  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
    Can you post a sample db here? Might help to see example data and your expected result.
    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: 2
    Last Post: 09-21-2011, 01:30 PM
  2. Cant Figure This Out
    By tabbycat1234 in forum Forms
    Replies: 12
    Last Post: 07-27-2011, 02:19 AM
  3. Need a query to figure all possible combinations
    By julestrip in forum Queries
    Replies: 1
    Last Post: 05-27-2011, 07:23 AM
  4. Cannot Figure this query out
    By ryan1313 in forum Queries
    Replies: 6
    Last Post: 08-13-2010, 12:54 PM
  5. Can't Figure It Out!!
    By jdohio5 in forum Database Design
    Replies: 1
    Last Post: 05-04-2006, 06: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