T
Tom
I am wondering how to use a SINGLE query and utilize no, one, or both of the
criteria depening on my login criteria.
The 2 criteria are:
[Forms]![frmLogin].[cboDivision]
[Forms]![frmLogin].[cboManager]
Now, depending on someone's login criteria, there will be different levels
of hierarchy.
1. One user may be only allowed to view reports on the "Manager level"... in
this case, I need to execute the query with BOTH criteria (cboDivision) and
(cboManager) included.
2. Another user could be allowed to view reports on the "Division level"...
in this case, he should see all branches that are branches that are part of
his/her division. Hence, I only want the query to include the the
(cboDivision) criteria.
3. Finally, the most senior level user should be able to view all records,
so I do NOT need to include any criteria.
Yes, I simply could create 3 queries that will list neither, both or only
the cboDivision criteria. And depending on the login, I would execute the
proper one. However, I don't want that... Copying the SQL code into VBA
and executing the proper one via CASE SELECT would be just like creating 3
queries.
So, is there any way to have a SINGLE query and make it somehow dynamic (in
respect to what criteria needs to be included/excluded)?
Tom
criteria depening on my login criteria.
The 2 criteria are:
[Forms]![frmLogin].[cboDivision]
[Forms]![frmLogin].[cboManager]
Now, depending on someone's login criteria, there will be different levels
of hierarchy.
1. One user may be only allowed to view reports on the "Manager level"... in
this case, I need to execute the query with BOTH criteria (cboDivision) and
(cboManager) included.
2. Another user could be allowed to view reports on the "Division level"...
in this case, he should see all branches that are branches that are part of
his/her division. Hence, I only want the query to include the the
(cboDivision) criteria.
3. Finally, the most senior level user should be able to view all records,
so I do NOT need to include any criteria.
Yes, I simply could create 3 queries that will list neither, both or only
the cboDivision criteria. And depending on the login, I would execute the
proper one. However, I don't want that... Copying the SQL code into VBA
and executing the proper one via CASE SELECT would be just like creating 3
queries.
So, is there any way to have a SINGLE query and make it somehow dynamic (in
respect to what criteria needs to be included/excluded)?
Tom