Obtain and use UserName from .ldb file???

J

James W

Hello.

- Shared .mdb
-Access 2000
-Users log on through user level security

I want to be able to "Capture" the UserName each time a new record is
created.

The db records incoming calls and details sales enquiries etc.

I want each record to have the UserName automatically "Stamped" on the
record when it is created.

I need to avoid users being able to edit the records to change the user who
created the record.

Currently the users select their name from a combo box on the form.

Can I obtain the logged on UserName from the .ldb file?

If so.............How???


T.I.A.
 
G

Guest

in you user name field put the default to =currentuser() and lock that field
in your forms.
 
N

Nikos Yannacopoulos

James,

Further to Chris's reply, this will only do the trick if you have
implemented Access security, so each user has to log onto the database
with a unique username. If this is not the case, then you can use:
=Environ("UserName")
which will return the user's login name on the Windows domain (which
should be unique per user).

HTH,
Nikos
 
N

Nikos Yannacopoulos

Doug,

I've heard this before, not sure if it was you again. My
counter-argument is users don't know an environment variable is used,
they don't even know what an environment variable is, let alone how to
change it. I don't know how to change it either, so last time I got this
remark I asked, and was told it's done through the command prompt,
something like Set UserName = "abc" or something, if memory helps, which
I tried and which didn't work. Would you please tell me what the exact
command is, so I can give it another shot?

Thanks,
Nikos
 
D

Douglas J. Steele

If you use Set Username=abc (no quotes required), it'll be changed while
that DOS box is open.
 
N

Nikos Yannacopoulos

Doug,

Thanks but it's still not working (WinXP Pro). I run the command in the
DOS window, no response, no error message. I leave the DOS window open,
go back to Access VBA immediate window, type ?Environ("Username") and
get the original Windows logon name, no change taken place. A version
thing maybe?

Regards,
Nikos
 

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