these notes are connected to John by his ID and to the Project by Projectname.
Would appear to be a likely issue. Exactly how did you set up your relationships linking notes to both projects and contacts? (there's more than one way you might do that.)
Both notes and projects is linked to contact by ID. Notes and Projects are not linked.
in project you enter a project for example "website"
then when entering a note you can choose to wich project it belongs and you can choose from a list of project with related contact ID
Then your notes are not linked to Projects by Project Name.
If you are trying to set up a list of projects as a list or table view layout based on Projects, you have no direct link to Notes for that project. You have a link to contacts which then links to all notes for that contact and Last returns the last note made for that contact, not the last note for that project.
I suggest this set of relationships:
Contacts::__pkContactID = Projects::_fkContactID
Projects::__pkProjectID = Notes::_fkProjectID
And __PkProjectID is NOT the name of the project, but an ID generated as an auto-entered serial number or Get (UUID). With each note linked directly to Projects your Last function will return the most recently recorded note for each project. (And an easy way to record notes is in a portal to notes placed on the Projects layout.)
PS, you can have it both ways as long as you make sure that the correct values get entered into the match fields in the Notes table, you can set up one Tutorial: What are Table Occurrences? of Notes to link to contacts and a different one to link directly to projects.
Okay I understand that. But by auto-entering Notes::_fkProjectID I can't manage which project belongs to my note?
I added and image for you to get a better view on what I want.
Okay, i got it, don't know what went wrong the first time but your option works perfect now.