Query for Value Across Multiple Columns (1 Viewer)

ndoctor

New member
Local time
Today, 15:14
Joined
Jul 9, 2019
Messages
2
Hello! I am pretty new to access, so there is a good chance that I am messing everything up :)

Overview: I am creating an access database to help managers create weekly employee schedules across approx 10 locations.

Set up so far:
1. Mock Schedule (Table): Provides shell weekly schedule with positions and time frames that need to be filled
2. Roster (Table): Listing of all employees
3. Location 1 Schedule (Form): Outward facing form where managers can select employees from a list to fill empty schedule slots. Columns: Monday Shift, Monday Employee, Tuesday Shift, Tuesday Employee, etc. Rows: Each row is a different position that needs to be filled.

What I need (Picture provided in attachment):
I need a way to create an output with each employee on a row that shows the shift and position they are scheduled for for each day of the week. Basically I want to say "Look at the name on the ROSTER table and find matches anywhere in the MOCK SCHEDULE table. Return the row (position name) and shift column.

Any help you can provide would be greatly appreciated!
 

Attachments

  • IMG_0521.jpg
    IMG_0521.jpg
    89.8 KB · Views: 97

Ranman256

Well-known member
Local time
Today, 16:14
Joined
Apr 9, 2015
Messages
4,337
you do not seach across columns, access seaches down a column.
otherwise your database is designed wrong.
you may want this design:

person, job, Date, Shift
john, cook, 1/1/19, 1
john, dishes, 1/2/19, 1
sue, cashier, 1/1/19, 1

output can always be made to look like your postit notes, but storing data does not.
 

ndoctor

New member
Local time
Today, 15:14
Joined
Jul 9, 2019
Messages
2
That is what I am looking for, how to make the output look that way.

The business unit wants to look at scheduling (input) from the lens of what the location needs, not from an employee perspective which is why I have the table designed like I do. However, I need the output to be one employee per row.

I am actually going to eventually need 3 outputs, but I am just working on this one now. I will need:

1. Schedule by employee (what I described above)
2. Schedule by location (mimics the current input)
3. Daily list of employees that should be working
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:14
Joined
May 7, 2009
Messages
19,230
something like this.
note I did not used the id field (pk) on the combobox
since this is only a demo.

see mockschedule table.

I also created a function that will determine the current Monday of the week.
see module1.

query1 is a union query so if there are Wednesday, Thursday, etc. dates in mockschedule you will add it in the query in the future.

the final query is query2, the demo is upto Tuesday only, same with query1 you will need to add the Wednesday, etc...
 

Attachments

  • mocksched.zip
    24.5 KB · Views: 85

Users who are viewing this thread

Top Bottom