I'm using an access database as a member management application for our swimming pool. I use a report to print out all of the season passes that have a picture ID. The report uses a query to only print passes for patrons who have had their photo taken.
SELECT tblPassHolders.[PASS HOLDER NAME], tblPassHolders.PHOTO.FileData, tblPassHolders.BARCODE, tblPassHolders.[FAMILY PASS], tblFamilyPass.Expires
FROM tblFamilyPass INNER JOIN tblPassHolders ON tblFamilyPass.ID = tblPassHolders.FamilyID
WHERE (((tblPassHolders.PHOTO.FileData) Is Not Null) AND ((tblFamilyPass.Expires)>Now()) AND ((tblPassHolders.Printed)=False));
This is year two of using the application, and the problem I'm having is when people re-take their pictures for their pass, then my report prints out a pass for each photo attachment attached to their record.
I'm very amateur with Access still and I'm struggling to figure out how to edit my report/query so that the report will only print one pass for each patron using the most recent photo attached to their record. One solution is to simply delete the old photos so there's only ever one attachment, but I'd like to figure out how to make it work even if there are multiple attachments. I've been playing around with DLast()
but I'm pretty sure I'm doing it wrong.
How do I make a query that will only show the most recently added attachment?