Only Displaying the newest record per EmployeeID but all fields within that record (1 Viewer)

jazor316

New member
Local time
Today, 06:08
Joined
Nov 30, 2019
Messages
6
Hello,

I am fairly new to access so pardon any stupid questions i might ask in advance.

Anyways, I am creating a database to help me schedule, and eventually i want it to help me eliminate having to remember who can work which days, and not. But its brand new, and this is honestly my first project i am tackling on in Access.

So to start, I have one table that records all my employees information called Employees. I have another table that records my employees Regular Weekly Requests called EmployeeRegReqOff. (this table basically records which days employees want off on a regular basis per week) each record input will have the date that the request starts, and then there are separate fields that represent days that can be checked yes/no if they need that day off or not.

so what i am trying to do is create a query that shows me only 1 (newest date) of each EmployeeID and all the fields associated with that record.

I was able to create a query that shows me the one record per employee with the date of their last request, (by using the group by EmployeeID, FirstName, LastName, and Max of RequestStartingRegDate) however, when i try to add the other fields that go along with that record set, more than one record per employee start showing up (im assuming because its grouping by those extra fields too now).

I've tried creating a subquery or nested query?, but i am getting confused with the syntax and since im fairly new to all this not sure how to execute my idea. I've tried googling things and playing around with for statements, but not sure how i input those into the query or how that would even work.

It makes sense in my head, but making it do whats in my head i'snt working out :( If anyone could help me, i would really appreciate it. I'm very eager to learn this!


If you need more info let me know and i'd be happy to answer what i can.

(one thought i had but i couldn't get to work on my own was to use the query that does work currently called "MondayNewestDateRegReqOff" that correctly displays just the EmployeeID, FirstName, LastName, and MaxOfStartingDate to and join it with another query that i have that works called "AllMondayRegReqOff" that shows all of the requests from the "EmployeeRegReqOff" and have it show only the records on the MondayNewestDateRegReqOff, but then add the fields that are associated to it from either the AllMondayRegReqOff or even the EmployeeRegReqOff but neither of those seem to be possible or at least the way i was trying to do it)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:08
Joined
Oct 29, 2018
Messages
21,454
Hi. Welcome to AWF! If you can't make a subquery work, how about using two separate queries instead?
 

jazor316

New member
Local time
Today, 06:08
Joined
Nov 30, 2019
Messages
6
Does this work for you?


Sounds like where you were headed.


:D OMG!!! Yes, this is exactly what i was trying to do and searching for for 2 days. You're the best! Thanks for the fast response too. Wish i could of found that link on the web somewhere. So glad i signed up and asked on here.

I can't wait to keep going now and keep learning this stuff. It's fun!
 

jazor316

New member
Local time
Today, 06:08
Joined
Nov 30, 2019
Messages
6
Hi. Welcome to AWF! If you can't make a subquery work, how about using two separate queries instead?

I got it to work with what pbaldy sent me. Thank you too for replying though!
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:08
Joined
Aug 30, 2003
Messages
36,124
:D OMG!!! Yes, this is exactly what i was trying to do and searching for for 2 days. You're the best! Thanks for the fast response too. Wish i could of found that link on the web somewhere. So glad i signed up and asked on here.

I can't wait to keep going now and keep learning this stuff. It's fun!

Happy to help!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:08
Joined
Oct 29, 2018
Messages
21,454
I got it to work with what pbaldy sent me. Thank you too for replying though!
Hi. Glad to hear Paul was able to help you. Good luck with your project.
 

Users who are viewing this thread

Top Bottom