Hello experts,

I have a project that's going to be used by several users, some of the user (X) will be incharge of giving/writing a task for specific user and most of the user (Y) will view and update the progress of the task assigned to him, the project is password protected, each user has its own username and password, my question is, how i can make the username as their profile and show only what he (X) created task and assign to (Y), and (Y) will see only the task assigned to him and update.

I hope that my question is clear.

Thanks in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Which application/tool are you using? Sorry couldn't figure that out..
CzherAuthor Commented:

I'm using MS Access
You could VBA Code to retrieve current username assuming they are logged on using it.

The sample VBA code is available on the Microsoft Site at the link given below:
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

CzherAuthor Commented:
but where i will put that code?, can you please give me some example

I do this on one of my databases.

Can you upload your database and tell us which forms your want filtering by user.  Then we can give you the exact code you need
You can create a VBA Module in Access to put the mentioned code and make a call in your Project to make a choice on options to displayed to the user. This could be used by doing a cross referencing with list of users in another table and mapping them with their respective roles.

So essentially this would mean:
1. When Access application starts you check the logged on user name
2. You make query to access table to identify role assigned to the user
3. You display forms/options available to that role such as Project Manager

Hope this helps.
CzherAuthor Commented:

i attached the sample mdb similar to my project.

have a look on it and tell me what i need to do.

Thank you so much

Just had a quick look over it.

You would only need one query/form for users Y, Z, A and B.  We'll call this frmUser_Home.
On this add an unbound text box and rename it txtUser. (you can set its Visible property to false if you dont want the users to view this, and make sure that the Locked property for this text box is set to true so users cant put in another users username).

Copy the code given by pritamdutt into the on Open event for frmUser_Home.  Replace the code at the bottom where it displays the user name in a message box so that it assigns it to the text box on the form instead, something along the lines me.txtUser = lpUserName.

You may then have to get it to refresh the form after this e.g me.frmUser_Home.requery

Then in the query for this form, in the username criteria add a reference to the textbox on the form which stores the username e.g [forms]![frmUser_Home]![txtUser].

This way it will only display records associated with the username that is in the textbox on the form which is automatically populated when the form opens.
CzherAuthor Commented:
how about the user X and W?

can you please do it on the example i attached?

Thank you
are you setting up users username and password through the User-Level Security Wizard
@Czher : I understand that you require the application to manage projects for you.

For a easier project management the entire Team can be divided into specific role groups e.g.
- Project Manager
- Team Leader
- Developer
- Tester
- Designer
and heceforth.

This hierarchy is dependent on the type project you are planning to manage.
With this in mind these are the following steps required to be done
1. Classify all users into appropriate role
2. Create a Table of Users
3. Create a Table of Group/Roles
4. Create a Table for User and Supervisor Mapping
5. Design Forms for Specific groups as they would most likely have similar requirements
6. On application launch call the VBA function to Identify the User
7. Lookup the User Role/Group from the mapping table and display the relevant screen/form
8. Based on UserAndSupervisor mapping table you could display the direct reports of the supervisors for giving assignments.

Hope this logic will help you build your desired application.
CzherAuthor Commented:

I have a different username and password setup, i didn't use the wizard
What setup did you use?  The code from MS supplies the username of the user logged into the computer, not the user logged into the database which means we'll have to try something else but until i know exactly how you have set up the security i cant do that.
CzherAuthor Commented:
i created a VBcode, where i group the users and put access level to each group , enable some module to a user which permits them to use and disabled other module which prohibits them to access,
now in this case, the project that i'm doing, what i need is not a group of users but individual access, for example user X will write the task for user Y and Z, but user W will not see or dont have access to view what user X assign to his subordinates (Y&Z) and vice versa, for user Y,X,A,B will see only what task asign to each one of them and not to see other task.
I presume in the code you have written there will be some sort of variable where the username is stored, otherwise without that you wont know which group the user belongs to, right?
@Czher you are on right track.

- As a next step, following are scenarios for you:

1. Assign Task
- Create a Query to Select List of Assignable Users
In case of X the list of Assignable Users will be Y and Z
The queries could be
//List Assignable Users
Select * from Users where ReportingTo=X

//Assign Task
Insert into Tasks (TaskName,AssignedTo) Values ("Task Assigned to Y", "Y")

2. List Tasks assigned
- Create a Query to List Task Assigned to an User
In case of Y .. query could be like
Select * from Tasks where AssignedTo=Y
and In case of Z it would
Select * from Tasks where AssignedTo=Z

I hope this helps...
CzherAuthor Commented:
can you please do it to the file that i attached, because i tried what you said in that sample, but it didn't came out as what i want to do.

What issue are you facing.. Can please upload the latest file with errors.
CzherAuthor Commented:
its not an error, what i mean is, the explanation that you just said is not the output that i want, or what i did is not correct, i dont know, that's why i'm asking you if you can do it to the sample that i uploaded, so that i can see your idea.

I hope you are not expecting me to design the entire application...

Never mind as a Proof of concept  I have done the following in your database

1. Added Following queries
- qryAssignTasks     - Append Query to assign Tasks
- qryEmployeeId      - Query to Findout Employee Id of Currently logged on User
- qryFindTasksAssignedToMe  - Query to Find out all the tasks assigned to me
- qryWhoCanIassignTaskTo - Query to Find out employees to who I can assign Taks
- qryWhoIsMySupervisor - Query to find out who is my supervisor

2. Added VBA code to find out UserId of Current user using the system

3. Update your Read Me First Code to
- Display Greeting to the Logged On User - Proof Of Concept that current logged on username can be identified
- Display Count of Tasks assigned and their list

Hope this helps!!!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CzherAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.