Results 1 to 5 of 5
  1. #1
    jamarogers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Location
    Mendenhall, MS
    Posts
    19

    Unhappy Using Max Function to display latest record


    I am trying to display (on a form, OneSideOfRelationship) the last "Date" of an item purchased in a related table(ManySideOfRelationship). I am using " =Max(DLookUp("POItDteRcd","POItems","POItNme = Forms![Inv]![InvName] And POItSize= Forms![Inv]![InvSize]")) " but nothing is returned and I get no error. The "DLookUp" works fine, but when I add the "Max" function, all I get is an empty field. Can someone please advise?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by jamarogers View Post
    I am trying to display (on a form, OneSideOfRelationship) the last "Date" of an item purchased in a related table(ManySideOfRelationship). I am using " =Max(DLookUp("POItDteRcd","POItems","POItNme = Forms![Inv]![InvName] And POItSize= Forms![Inv]![InvSize]")) " but nothing is returned and I get no error. The "DLookUp" works fine, but when I add the "Max" function, all I get is an empty field. Can someone please advise?

    I goofed and posted my earlier response in the wrong thread!

    I don't know the answer to your problem but I will take a look at it. Sorry for my earlier response.
    Last edited by ItsMe; 09-29-2013 at 09:42 AM. Reason: I clicked the wrong thread

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    The only thing I see wrong is that you added max in front of a functioning DLookup statement. The following should display the max date.

    DMax("POItDteRcd", "POItems", "POItNme = Forms![Inv]![InvName] And POItSize= Forms![Inv]![InvSize]")

  4. #4
    jamarogers is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Location
    Mendenhall, MS
    Posts
    19
    Thanks for that...did not know about DMax...here's my final expression, which worked fine:
    =DLookUp("POItCost","POItems",'POItNme = Forms![Inv]![InvName] And POItSize= Forms![Inv]![InvSize] and POItDteRcd =DMax("POItDteRcd","POItems","POItNme = Forms![Inv]![InvName] And POItSize= Forms![Inv]![InvSize]")')
    This looks through the POItems and selects the Cost for the Latest received PurchaseOrderItem.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Glad you got it going

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

Similar Threads

  1. Remove duplicate but keep the latest record
    By Compufreak in forum SQL Server
    Replies: 2
    Last Post: 06-12-2013, 11:55 AM
  2. Replies: 5
    Last Post: 04-26-2012, 05:25 PM
  3. Get latest record
    By Sweet16 in forum Queries
    Replies: 9
    Last Post: 09-23-2011, 01:39 PM
  4. Code to display latest record number field created?
    By rowardHoark in forum Programming
    Replies: 1
    Last Post: 01-31-2011, 08:03 AM
  5. Query latest record
    By asherbear in forum Queries
    Replies: 5
    Last Post: 08-02-2010, 03:58 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