Link to home
Start Free TrialLog in
Avatar of fabi2004
fabi2004Flag for United States of America

asked on

Help choosing most recently dated record in an Access table

I don't know if I'm missing something basic or if I've set the tables up wrong in the first place.

I need to choose the most recent status record from the tblProviderStatus for each combination of AssignmentID & ProviderID.

It works until I add the field for Status (either ID or Code or Description - any of them).  Then, it doesn't work anymore.  I get all dates for each combination of ProviderID and AssignmentID instead of only getting the most recent one.

I don't know if the problem is in my table design, in my table relationships or simply in my query design.

User generated image
Any ideas?
Day-Tracker-v6.accdb
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of crystal (strive4peace) - Microsoft MVP, Access
crystal (strive4peace) - Microsoft MVP, Access

By default, all joins lines between tables/queries are inner joins -- that is, they will limit records to just those that have matching keys. You want to show records even if there are not related records

right-click on the link line joining Assignments to Provider Status and edit the join properties. Choose to show all records from Assignments, and only those from ProviderStatus where they match.

Do the same for the join line between ProviderStatus and Status -- all from ProviderStatus. Same for Providers. Watch the arrows -- they will point to the table that can be dropped.

For the problem with ID... Do you mean OrderID? Be sure that the DefaultValue for OrderID in Assignments is not set to 0, as Access does for you (which is usually not desired!) -- this, most likely, won't match anything (and also indicates that you did not define relation ships with referential integrity)

don't feel bad about not doing things that need to be done ... Access is powerful and, because so, can be hard to learn.

Do these things and then come back with your questions ~
Avatar of fabi2004

ASKER

Pawan, that worked.  Thank you for such a quick solution!!!
Welcome !!
Crystal, thank you for the advice.  I will certainly keep it in mind.