Select the most recent record from a table that is linked to another table

Modify_inc

Registered User.
Local time
Yesterday, 19:08
Joined
Mar 25, 2013
Messages
20
I have a basic database design, well I think so anyway. It only has two tables:

1. tblClientInfo
2. tblNotes

Basically each client has multiple notes/comments that can be linked to its record, hence the tblNotes table. The two tables have a one-to-many relationship, being that each customer can have many notes.

I then have two forms:

1. Claims Loss Form
2. tblNotes_DatasheetSub1

So I can enter multiple notes for each customer. The problem I am having is with the report output. It wants to print every note (record) that is linked to the customer. I just need it to print the most recent note for each customer (It would save a lot of wasted paper).

Example of a print out of what it is doing:

John Doe - 123 Easy St - Notes 1 (Most Recent Note)
John Doe - 123 Easy St - Notes 2 (Previous Note)
John Doe - 123 Easy St - Notes 3 (and so on...)

It is printing duplicates of the same customer by adding the additional notes for that same customer on a new line.

How can I tell it to only print the customer one time in the report, and most importantly, to only use the most recent note that is linked to the customer?

I tried using DMax("NoteDate","tblNotes"), but this only returns one customer with one note. I need it to do that for each and all customers.

I have successfully ran a subquery (two queries with one linked to another) by following detailed instructions from this page I found: http://www.databasedev.co.uk/access_max_function.html.

It works, but the problem is it only shows the latest date for each note, not the actual contents of the note. I feel so close with this option, but so far at the same time.

The TOP n records per group looks promising that I found here: http://allenbrowne.com/subquery-01.html#TopN, but I honestly don’t know how to implement it correctly in my SQL. I am very much still learning Access and apparently have stumbled into something that is much more complicated than I had originally imagined. I just assumed I could filter the duplicates out, or tell access to print the last or most recent note record for each customer.

If anyone is knowledgeable in this area or has successfully accomplished a similar task in Access, I would love to hear from you.

Thanks
Mike
 
I can't explain... It's simpler to show. See attachment.
Thanks for trying to help, but the database you attached was very confusing for me.
I could only imagine if you had tried to explain it to me without it.

Fortunately I have finally figured out my issue and have successfully created a report that will only display the last note (record) of every customer.

I re attempted the TOP n records per group method, and finally got the results I required.

Thanks again
Mike
 

Users who are viewing this thread

Back
Top Bottom