I am trying to build a query where I can get the first non null id available in multiple columns
So my main table is like this,
| employee id | name | manager |
|---|---|---|
| 1 | John | |
| 2 | Doe | |
| 3 | Jane | |
| 4 | Phil | |
| 5 | Jen |
I want to lookup the manager from the following table
| employee id | Manager ID | Senior Manager ID | Director ID | Senior Director ID |
|---|---|---|---|---|
| 1 | 21 | 22 | 23 | 24 |
| 2 | 22 | 23 | 24 | |
| 3 | 23 | 24 | ||
| 4 | 24 | |||
| 5 | 22 | 23 | 24 |
And my output should be something like this
| employee id | name | manager |
|---|---|---|
| 1 | John | 21 |
| 2 | Doe | 22 |
| 3 | Jane | 23 |
| 4 | Phil | 24 |
| 5 | Jen | 22 |
So basically, I tried to use this IIF function to do a nested if, and a switch function. Both didn't return the output that I was expecting. Thanks!
Edit 1: I tried with Nz, but it works for ManagerID and SeniorManagerID but doesn't work for DirectorID and SeniorDirectorID for some reason. Meaning, I can get ManagerID and SeniorManagerID, but for the other 2, it returns blank.
Edit 2: I tried to change the query to instead of checking for NULLs, I tried to changed it to empty string, still didn't work.

The Nz() function is used in Access
Otherwise, would be a much longer expression using IIf() or Switch and IS NULL. More info http://allenbrowne.com/QueryPerfIssue.html#Nz