Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tasks for users

Status
Not open for further replies.

Lightlancer

Programmer
Jul 18, 2008
88
NL
Hi there,

When a user logon into the database, his username is stored in a variable named:
Code:
Public gstrDezeWerknemer As String

this is stored in a VBA module.

When the database opens, and the user clicks on tasks, he will see everybody's tasks. but i want that he can only see his own tasks. How can this be done???

Also, the user administrator must see all tasks.

Thanks in advance

Lightlancer
 
How do you see this happening? A filter, a query, a recordset?
 
As Remou points out there are several ways to do this. If you are using a query then wrap the variable in a function.

public function getUser() as string
getUser = gstrDezeWerknemer
end function

now you can use this function in a query.
 
ah, srry i forgot to tell, its a query.
its in the function.

but i need to tell the form that he must look for this getuser function, and then put up a filter or something like that, so he will only show the tasks for this user....


Greetz

Lightlancer


 
Using MajP's suggested function:


[tt]SELECT F1, F2 Fn FROM tblT WHERE UserID=GetUser()[/tt]


<aside: I will stick with RVBA in this case :) >
 
If you have access security set up I would create a table or query that has all of that users tasks in it. Create a form that pulls in the information in that table/query and make it a sub form. In the on load event of your subform put in this code:

If [currentuser] = "username" then forms!mainform!subform.sourceobject = "frm_user1tasks"

If [currentuser] = "Administrator" then forms!mainform!subform.sourceobject = "frm_alltasks"

Of course you will have to create several queries for each user.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top