I would like to use the windows username with MS Access - how do .

V

Vasanti

Hi,

I am finding it difficult to pick up te Windows XP username from within
Access. I need it to tag changes made with the username of the Windows login
name
 
N

Nikos Yannacopoulos

Vasanti,

The expression:

Environ("UserName")

will return the Windows logon name, and it will work virtually everywhere
(queries, forms, reports, VB code etc).

HTH,
Nikos
 
C

Chas

I too am attempting this. I am somewhat new to this part of Access, I have
followed the instructions on the site but am stuck now.....when the user
starts the database, I have a switchboard come up. Where/how do I call the
function to get the username?
 
A

Alex Dybenko

Add a label to your switchboard form Label1
then in Forms Load event write:
me.Label1.Caption= fOSUserName()
 
C

Chas

Maybe I am missing something....Thanks for your quick response. I did do
that, then saved/closed it. When I re-opened it, nothing happened.
 
A

Alex Dybenko

did you enter this in VBA code?
then open debug window and type there:
?fOSUserName()

will you get user name?
 
D

Douglas J. Steele

PMFJI, but did you perhaps name the module fOSUserName when you saved it?
The module name cannot be the same as any function or subroutine.
 
C

Chas

No, they are both different.
Is there a way to take the user name and have it displayed as a msg box
greeting?
 
A

Alex Dybenko

well, if ?fOSUserName() returns username in debug window - it also should be
shown on label caption

maybe misstyped function name?
 

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