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

Using Database "Current User" Information in Access Records / Tables

Status
Not open for further replies.

polly2carpets

Technical User
Oct 26, 2006
3
GB
Hi all,

What I want to be able to do is record the current database user name (i.e. the person currently logged into the database) in a field of a record at the point of its creation. I have seen the thread thread700-1099785 which started off asking a similar question but ended up with a solution to retrieve the current Windows login, which is no use to me.

What I have done is created a database with logins for specific users (security is implemented) to record operational problems at my plant. When I log in with the different IDs, I can see the "current user" is changing by looking at Tools->Security->User and Group Permissions (visible at the bottom) but when I try the scripts shown in thread700-1099785 I always get the windows login ID, not the database current user.

I want the database to automatically enter a persons login name when they go in and create a new record in a field called ReportedBy.

I'm sure there's a way to do it but I can't figure it out. I surely can't be the only person who has wanted to do this... Please help [sadeyes]

Once I can get this information, I want to be able to use it elsewhere (e.g. in queries) so that when someone logs in they can run a report to show records that only have actions for them associated with them (filtered for "current user" value)

Thanks,

Polly2Carpets


"I keep pressing "Esc" but I'm still here
 
the person currently logged into the database
Use CurrentUser instead of Environ("USERNAME")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for that, but I have tried it and the value in the field always returns the Windows login name, not the name of the person logged in to the database.

Should it return the database current user?

 
Application.CurrentUser returns the database current user.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Spot on,

It now does what I want it to do. Thanks very much. You've been very helpful =')

Cheers,

Polly2Carpets
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top