Get the last dataset (1 Viewer)

georg7

Registered User.
Local time
Today, 03:40
Joined
Sep 3, 2019
Messages
84
Hi there,
I've a db with table(Tabelle2 mitarbeiter) for all employees and a table(Tabelle1 tname) to save who worked together. Now I want to create a querry that shows only the last dataset. I tried it with Max(ID) and Last(ID). Hopefully someone can help.

Best regards
Georg
 

Attachments

  • work together.PNG
    work together.PNG
    10.1 KB · Views: 70
  • workers.PNG
    workers.PNG
    10 KB · Views: 72
  • Test222.accdb
    456 KB · Views: 76

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:40
Joined
May 7, 2009
Messages
19,243
you need 2 queries:

1st query (qryMaxID):

SELECT Max(Tabelle1.ID) AS MaxOfID
FROM Tabelle1;


2nd query (qryLastWorkedTogether):

SELECT Tabelle1.ID, Tabelle1.tname.Value, Tabelle1.tname
FROM Tabelle1 INNER JOIN qryMaxID ON Tabelle1.ID = qryMaxID.MaxOfID;
 

georg7

Registered User.
Local time
Today, 03:40
Joined
Sep 3, 2019
Messages
84
Thank you @arnelgp it worked ! Do you know how I get a report that Displays the last query? The report don't Shows the single names like in the query..
 

Attachments

  • qry_rpt.PNG
    qry_rpt.PNG
    19.6 KB · Views: 82

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 18:40
Joined
May 7, 2009
Messages
19,243
its a Multivalue field so you have to create a function to
retrieve the Names.

see the report and the code in it.
 

Attachments

  • Test222.zip
    57.4 KB · Views: 91

Users who are viewing this thread

Top Bottom