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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to detect current logged in user from msaccess security

Status
Not open for further replies.

softbrix2

Technical User
Feb 28, 2005
17
US
I have a database with tons of customers, I want each sales person to only see the customers they entered and not everyone else customers. I'm using msaccess built-in security. How can i detect the current logged in user and filter the data base on that user. I can't use the enviro(username) because we are not using the same username from the network. we are using the usernames from the access security wizard. So I'll like to filter the form to only show data that was entered by that user?
 
From Help:

CurrentUser

Remarks

The CurrentUser method returns a string that contains the name of the current user account.

If you haven't established a secure workgroup, the CurrentUser method returns the name of the default user account, Admin. The Admin user account gives the user full permissions to all database objects.

If you have enabled workgroup security, then the CurrentUser method returns the name of the current user account. For user accounts other than Admin, you can specify permissions that restrict the users' access to database objects.

The following example obtains the name of the current user and displays it in a dialog box.

MsgBox("The current user is: " & CurrentUser)
 
softbrix2

>I want each sales person to only see the customers they entered

This means that you are already storing the sales person 's userID on every customer in a field. Create a query that selects the customers and filter that field with the CurrentUser() Remou is talking about
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top