I have a form that has a drop down combo box with the names of 3 people, and an All option. When the user makes a selection and presses the button, they see records from one of the three people, or all of them.
In the underlying query, I have a table where the names of the people come from in the drop down list (managerTbl) and I also have a table that contains the programmers(TblProgrammers).
So what happens, is when you select a manager name from the dropdown box and press the button, you get a list of all the names that report to that person.
When you select all, you get a list of all of the employees from all three managers.
Here's the problem: In each of the tables, I have a field called, 'active'. That way if a person is no longer working here, it is simple to remove them, by unchecking the checkmark in that field. The problem is that when I select a manager name and press the button, the list of programmers is correct which only shows active people, however when you select the 'All' option, it is showing everyone, including the inactive people.
I need to put something in the sql so when the 'All' option is selected, it will also not show the inactive people. here is my code.
SELECT DISTINCTROW tblProgramers.ProgrammerLastName, tblProgramers.ProgrammerFirstName, tblProgramers.PgmrId, tblProgramers.DirectMgr, ManagerTbl.ManagerFirstName, ManagerTbl.ManagerLastName, tblProgramers.Active
FROM ManagerTbl INNER JOIN tblProgramers ON ManagerTbl.PgmrId = tblProgramers.DirectMgr
WHERE (((tblProgramers.DirectMgr)=[Forms]![reportsfrm]![manager]) AND ((tblProgramers.Active)=-1)) OR ((([Forms]![reportsfrm]![manager])='*'));
Note: when I tried putting the, ((tblProgramers.Active)=-1) on the "all" side of the OR statement, this is the error it gave: "Data type mismatch in criteria expression"
Please help.
In the underlying query, I have a table where the names of the people come from in the drop down list (managerTbl) and I also have a table that contains the programmers(TblProgrammers).
So what happens, is when you select a manager name from the dropdown box and press the button, you get a list of all the names that report to that person.
When you select all, you get a list of all of the employees from all three managers.
Here's the problem: In each of the tables, I have a field called, 'active'. That way if a person is no longer working here, it is simple to remove them, by unchecking the checkmark in that field. The problem is that when I select a manager name and press the button, the list of programmers is correct which only shows active people, however when you select the 'All' option, it is showing everyone, including the inactive people.
I need to put something in the sql so when the 'All' option is selected, it will also not show the inactive people. here is my code.
SELECT DISTINCTROW tblProgramers.ProgrammerLastName, tblProgramers.ProgrammerFirstName, tblProgramers.PgmrId, tblProgramers.DirectMgr, ManagerTbl.ManagerFirstName, ManagerTbl.ManagerLastName, tblProgramers.Active
FROM ManagerTbl INNER JOIN tblProgramers ON ManagerTbl.PgmrId = tblProgramers.DirectMgr
WHERE (((tblProgramers.DirectMgr)=[Forms]![reportsfrm]![manager]) AND ((tblProgramers.Active)=-1)) OR ((([Forms]![reportsfrm]![manager])='*'));
Note: when I tried putting the, ((tblProgramers.Active)=-1) on the "all" side of the OR statement, this is the error it gave: "Data type mismatch in criteria expression"
Please help.