Results 1 to 3 of 3
  1. #1
    Aubreylc is offline Novice
    Windows 7 Access 2007
    Join Date
    Jan 2010
    Posts
    10

    Find the latest purchase for each customer

    I recall it being fairly easy to find the latest purchase record for each customer but find myself running in circles.



    Out of the sample data below, I would look to return the whole record for 2006. I have 700K records to work through contained in one imported spreadsheet.

    Customer TradingPartner DeploymentID PurchaseDate
    Acme Warner Bros. 10001 11/16/1995
    Acme Warner Bros. 10001 2/18/2006






    Does anyone have any suggestions?


    -Aubrey

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Q1, make a MAX query on the purchase table, with only 2 FIELDS: CustID, Max(PurchDate)
    then
    make Q2, use Q1 and join to the tCustomer table to get the customer info.

    select * from tCustomer,Q1 where tCustomer.CustID = Q1.CustID

    (the MAX query must only have 2 fields because you want the MAX date of CUSTID.)

  3. #3
    Aubreylc is offline Novice
    Windows 7 Access 2007
    Join Date
    Jan 2010
    Posts
    10
    Thanks, I believe I got it working.
    The thing I was missing was:
    creating a relationship between the DeploymentID's in both the qry and tbl, in addition to creating a relationship between the MaxDate in the qry and the Date in the table.
    Click image for larger version. 

Name:	Capture.PNG 
Views:	7 
Size:	45.1 KB 
ID:	31186

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

Similar Threads

  1. Replies: 2
    Last Post: 10-27-2015, 09:12 AM
  2. Replies: 4
    Last Post: 07-04-2013, 12:07 PM
  3. Replies: 11
    Last Post: 10-31-2012, 09:12 PM
  4. Replies: 16
    Last Post: 10-23-2012, 10:42 PM
  5. Query to find latest date
    By Lockrin in forum Access
    Replies: 2
    Last Post: 12-16-2009, 10:00 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