Populating Field with Logon Name

J

Jeff Dale

I have a local Access database that I am sharing on my LAN.

We are running an AD environment.

What I would like to know is can I populate a field with the name of the
person that is making the entry in my database from a form.

This is an Access 2003 Database.

Thanks
 
S

Sharkbyte

One way you can do this is when the user logs in, put the name in an unbound
text field, on a hidden form. Then when you save the record, include a
reference to that form/field, and you have the user name.

Sharkbyte
 
J

Jeff Dale

Well I am not actually having them login to the database itself.

I am having them logon to the domain and was wondering if I can capture that
information without them having to enter anything. ( trying to make this as
foolproof as possible )


Thanks

JD
 
D

Douglas J Steele

Put the code in a module. (Do NOT name the module fOSUserName: modules
cannot be named the same as functions within them)

Use the function fOSUserName() to return the user Id anyplace you need it.
 
T

Tracey

Doug,
I'd like to get the user name from our sql server logon. Sometimes the
windows logon is different than the sql logon. How would I accomplish this
task?
Thanks,
Tracey
 
D

Douglas J Steele

That may be a little trickier!

SQL Server has a bunch of different "user ids" defined.

If you look in BOL (Books On-Line), you'll find at least:

CURRENT_USER
USER
SESSION_USER
SYSTEM_USER

While I once did some work on figuring out which is which, that was many
months ago (and, I think, several versions of SQL Server ago as well), and
unfortunately I don't remember which is which.

Try creating a pass-through query that returns whichever of those fields you
care about.
 
Top