Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access Query - Find most recent date in table

Posted on 2008-10-14
2
Medium Priority
?
1,592 Views
Last Modified: 2013-11-27
I have a table containing every invoice issued to a customer.  There are multiple records for each customer's business.

What I'm trying to produce is a query that will return a table containing only the most recent invoice record for each customer so I can follow-up customers who we've had no business with for more than 6 months.

The table has multiple fields but can you suggest a solution using the fields [Customer Ref#] and [Invoice_Date]?  I want to pull the whole record for their last business.

Normally I have no problem writing queries but this one has me stumped - I'm blaming it on a head cold :)

Thanks  M :o)
0
Comment
Question by:☠ MASQ ☠
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
rgn2121 earned 2000 total points
ID: 22709508
I don't do much with Access, but I have a site I got to if I do that might help...Here is a little code from it.

Select MAX(Invoice_Date), Customer Ref#  from Table1 group by Customer Ref#;

Now, that will only return thos 2 fields so you will have to link it back up.

With A as (
Select MAX(Invoice_Date), Customer Ref#  from Table1 group by Customer Ref#;
)

Select *
From Table1, A
Where A.Customer Ref# =Table1.Customer Ref#
AND  A.Invoice_Date = Table1.Invoice_Date

Something like that...the site should help lay it out better.  I generally work through the errors, but Since I don't have to data to work against I am just throwing it together....
http://www.techonthenet.com/access/queries/max_query2.php
0
 
LVL 63

Author Comment

by:☠ MASQ ☠
ID: 22711317
Thanks
Select MAX(Invoice_Date), Customer Ref#  from Table1 group by Customer Ref#;
Needed a little tweaking but fundamentally solved the issue.  It was MAX() I had forgotten!
0

Featured Post

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question