Results 1 to 5 of 5
  1. #1
    Madmartigan is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jun 2013
    Posts
    36

    Need Help With Query Criteria

    I don't know why I can't wrap my head around this one because it seems like it should be pretty simple but it just isn't working. I'm writing a Select Query against a Table that has these fields:

    Customer ID
    Move Date
    Customer Name
    Address


    City
    State
    Zip
    Phone

    A given customer can have multiple move dates and addresses for different places they have lived. What I want to do is write a query that pulls all customers by customer ID and selects their most recent move date and whatever address information happens to be associated with that record. In other words I want all customers and their most recent addresses. I've tried max, first, sorting, and I keep getting skewed or incorrect results when I validate. Any help is 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,641
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Madmartigan is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    Ok, let me see if I understand this correctly.

    I know that my customerID as it stands does not create a primary key. But the combination of customerID + Move Date does.

    So query #1 would find for each customer ID, the max move date.

    Query #2 would be linking my table to query #1 as a primary key to pull the rest of the records? Worded poorly, I know, but is that about it?

  4. #4
    Madmartigan is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jun 2013
    Posts
    36
    I tested it out and it appears to have worked! Thank you Paul for the help! Much appreciated!

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    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: 4
    Last Post: 05-02-2013, 11:07 AM
  2. Replies: 5
    Last Post: 05-01-2013, 11:39 AM
  3. Replies: 5
    Last Post: 09-20-2012, 03:27 PM
  4. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  5. Replies: 1
    Last Post: 07-13-2011, 11: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