Current User and combo box

G

Guest

Good morning,
I have user security on a workflow database with a manager and five
subordinates. The manager is the only one with Admins privileges. He is the
only one that has the ability to look at his own work items and the work
items of the subordinates. The Main form verifies if the user is a
CurrentUser, so it can tell if the manger is using the form. I have a combo
box where the manager can select the name of the employee and push a button
that opens an editing form. The form runs a query that pulls in that
employee’s work items. The problem is that the query is coming up blank.
Here is the SQL:

SELECT....
FROM [Main Table]
WHERE ((([Main Table].Username)=CurrentUser()) AND (([Main
Table].Employee)=[Forms]![Main]![Combo2]))
WITH OWNERACCESS OPTION;

Thank you.
 
G

Guest

The query aswritten would only return rows where the UserName column is the
manager's user name, which is what the CurrentUser function would return when
the manager has logged in to Access, AND where the Employee column is the
name selected in the combo box. I don't see the need for both criteria.

Which column you need to restrict the result set on depends which identifies
each row as the employee's work. Is it the UserName or Employee column? If
the former then the only criterion needed is:

WHERE UserName = Forms!Main!Combo22

if it’s the latter:

WHERE Employee = Forms!Main!Combo22

Ken Sheridan
Stafford, England
 
G

Guest

Thanks for the help. I removed the Current User from the query and that
enabled the combo box to work. That takes care of the Main form with the
combo box. But do I need to create an additional query for the employees?
This query has to be able to identify the current user so the employees can't
look at each others' work. When a user logs in they are taken to an entry
screen where they enter their last name, then they go to either an employee
form or the main form. (Main - where the manager can use the combo box to
look at everyone's work) The employee form needs to run queries that
identify the CurrentUser as that employee, and pull their work only. That
would prevent someone from logging in as themself, then typing in anothers
name in the entry screen and looking at their work. The Username and the
Employee are always the same person in the Main Table.

Thank you.

Ken Sheridan said:
The query aswritten would only return rows where the UserName column is the
manager's user name, which is what the CurrentUser function would return when
the manager has logged in to Access, AND where the Employee column is the
name selected in the combo box. I don't see the need for both criteria.

Which column you need to restrict the result set on depends which identifies
each row as the employee's work. Is it the UserName or Employee column? If
the former then the only criterion needed is:

WHERE UserName = Forms!Main!Combo22

if it’s the latter:

WHERE Employee = Forms!Main!Combo22

Ken Sheridan
Stafford, England

brem219 said:
Good morning,
I have user security on a workflow database with a manager and five
subordinates. The manager is the only one with Admins privileges. He is the
only one that has the ability to look at his own work items and the work
items of the subordinates. The Main form verifies if the user is a
CurrentUser, so it can tell if the manger is using the form. I have a combo
box where the manager can select the name of the employee and push a button
that opens an editing form. The form runs a query that pulls in that
employee’s work items. The problem is that the query is coming up blank.
Here is the SQL:

SELECT....
FROM [Main Table]
WHERE ((([Main Table].Username)=CurrentUser()) AND (([Main
Table].Employee)=[Forms]![Main]![Combo2]))
WITH OWNERACCESS OPTION;

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top