How to automatically track user in data field


G

Guest

How do I automatically track in my data field the user that is logged into
the database. What I am trying to accomplish is this.......

I have a field where the user would select his/her name and this information
is stored in the master table. However, since I have security set on the
database, they are logging in with a user name and password. I would imagine
access can automatically fill in this name field so the users do not have to
keep selecting their name for each record. Microsoft access will
automatically fill in the name field for each record based on their login
credentials. Is this possible and if so how?

Thanks!
 
Ad

Advertisements

L

Larry Linson

An Access built-in function, CurrentUser, returns the name by which the user
is logged in to Access. You can look it up in Help but an easy way to try it
out is to open a module window, view the Immediate Window, type in

? CurrentUser()

and then enter. If you don't think you are using security, it'll return
"Admin", because Access security is always on and the default login is the
"Admin" user.

But, even if you aren't using Access security with a workgroup file, you can
obtain the user's network login name, see
http://www.mvps.org/access/api/api0008.htm, or the current computer name,
see http://www.mvps.org/access/api/api0009.htm. I find these more useful,
in many environments, than the CurrentUser function.

Larry Linson
Microsoft Access MVP
 
P

PFC Sadr

Select Suser_sname() returns the current windows user

MDB is for retards; use SQL Server
 
P

PFC Sadr

and if you want to 'automatically keep track of database changes' you
can make an AUDIT TRAIL that includes TRIGGERS in the database.

MDB is for lamers and retards; and anyone that uses it should be FIRED
and then SPIT UPON

-Aaron
 
G

Guest

Where do I actually put the code in the input form so that the "user" who is
entering data in the form is tracked automatically in my master data table
for that record?
 
Ad

Advertisements

P

PFC Sadr

just use SQL Server

then set the default for that field to SUSER_SNAME()

If you go the MDB / VBA route; if someone disables macros then it
won't keep their username
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top