Obtain and use UserName from .ldb file???

  • Thread starter Thread starter James W
  • Start date Start date
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.
 
in you user name field put the default to =currentuser() and lock that field
in your forms.
 
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
 
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
 
If you use Set Username=abc (no quotes required), it'll be changed while
that DOS box is open.
 
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
 
Back
Top