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

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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?
 
Add a label to your switchboard form Label1
then in Forms Load event write:
me.Label1.Caption= fOSUserName()
 
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.
 
did you enter this in VBA code?
then open debug window and type there:
?fOSUserName()

will you get user name?
 
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.
 
No, they are both different.
Is there a way to take the user name and have it displayed as a msg box
greeting?
 
well, if ?fOSUserName() returns username in debug window - it also should be
shown on label caption

maybe misstyped function name?
 
Back
Top