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

Show logged in username

Status
Not open for further replies.

Tommyhat

Programmer
Sep 10, 2004
96
CA
I need to test the user logged into a MSAccess project database to redirect to a switchboard specific to the access permissions.

I looked in the archives but all i could find was =Environ("UserName"), but that's for the computer, not the database.

Thanks!


---------------------------------------
2b||!2b that == the_question
 
If you are using access security, CurrentUser() will return the Access login name.
 
That seems to only bring up "Admin" for each different user.

Can i get the username or is that all i can get?

---------------------------------------
2b||!2b that == the_question
 
The only way you can determin who is logging in is to trap the NT/network username (your original method) or to switch Access security on (i.e. from the security menu, set the password for Admin on). From then on everyone using the same MS Access workgroup would be prompted to enter a userid & password (which you would set up) and then CurrentUser() would work. Note: when Access security is not switched on, everyone is silently logging in as the user Admin(), this is whay you are getting that.

I am surprised that Environ("Username") didn't return the username you want. What network/operating system are you using?
 
Environ("username") returns who is logged into windows. I want to know who's logged into the database for permissions and such.

---------------------------------------
2b||!2b that == the_question
 
So then you need to use access security

SarahG said:
switch Access security on (i.e. from the security menu, set the password for Admin on). From then on everyone using the same MS Access workgroup would be prompted to enter a userid & password (which you would set up) and then CurrentUser() would work. Note: when Access security is not switched on, everyone is silently logging in as the user Admin(), this is whay you are getting that.

Check out ms FAQ on access security
--Todd


TechnicalUser pretending to be a programmer(shhh… the boss doesn’t know yet)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top