Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

Selecting last dated training record for each person

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sisingamangaraja - 25 Jun 2007 08:24 GMT
Hi all,

I have an existing table that looks like this (training periods are between
startdate-enddate, empty value is because the training is still on-going):

RecordNo - TrainingID - Startdate - Enddate - PersonID - ClassWhenAttending
1               Tr_A    21/01/2007    1/03/2007    1    C1
2               Tr_A    21/01/2007    1/03/2007    2    C1
3               Tr_B    1/01/2007    20/02/2007    1    C2
4               Tr_B    1/01/2007    20/02/2007    3    C2
5               Tr_C    1/06/2007    [empty]                2        C3
6               Tr_C    1/06/2007    [empty]                3        C3
7               Tr_C    1/06/2007    [empty]                4        C2

I want to select the record of each person (PersonID) where he/she (last
attended) OR (is last starting because training is not ended yet) so that the
result should be like this (each record of personid 1, 2, 3 & 4):

RecordNo - TrainingID - Startdate - Enddate - PersonID - ClassWhenAttending
3              Tr_B           1/01/2007    20/02/2007    1    C2
5              Tr_C           1/06/2007    [empty]                2        C3
6              Tr_C           1/06/2007    [empty]                3        C3
7              Tr_C           1/06/2007    [empty]                4        C2

Can someone help how to make a query design (using filter?) or a SQL
statement for this?

Thanks for your help.
Rudy
Wayne-I-M - 25 Jun 2007 08:38 GMT
Hi

Try this link

http://www.mvps.org/access/queries/qry0020.htm

Signature

Wayne
Manchester, England.

> Hi all,
>
[quoted text clipped - 25 lines]
> Thanks for your help.
> Rudy
sisingamangaraja - 29 Jun 2007 02:46 GMT
Thanks Wayne.

Your info helped a lot. I tried yesterday and it worked fine. The Library
case (BookID, DateOut, BorrowerID) is really similar to my case (TrainingID,
Enddate, PersonID) except I added IIF function in the SQL to check whether
using the latest Enddate or the latest Startdate (if Enddate is empty).

Cheers,
Rudy
Jakarta, ID - Canberra, AU

> Hi
>
[quoted text clipped - 31 lines]
> > Thanks for your help.
> > Rudy
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.