Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Max Aggregate incl Primary Key
Andy Wear 
   
4 years ago
Hi, I have a service table for multiple suppliers. I want to create a query that shows the last service date for each supplier (Max aggregate) and then open that record (using open Args).

Can this be done without getting the 'not included in the aggregate expression...' error?
Adam Schwanz  @Reply  
           
4 years ago
Can you just make a continuous form? Base it off the query and put a button to open the record?
Andy Wear OP  @Reply  
   
4 years ago
Sorry if I've missed something obvious but the query can't include the Record ID (primary key) because it is unique and being used with an aggregate function. Is there a way of including it? Just to clarify, the list only contains the last date for each supplier.
Adam Schwanz  @Reply  
           
4 years ago
You should be able to get the ID with DLookup since you have the maximum date and the supplier (assuming there is only going to be one record per supplier on that date.)

Example (could be different depending on field type)
DLOOKUP("ID","Table","Supplier=" & Supplier & " and Date=#" & MaxDate & "#")

Then open the form to that
Andy Wear OP  @Reply  
   
4 years ago
I didn't think of that, thanks I'll give it a try.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/16/2026 2:55:21 PM. PLT: 1s