Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieving UserName in XP 2

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
GB
The company I work for is due to change from NT4 to WinXP Pro in the next few months.

My team supports in excess of 200 MS Access databases, most of which use Environ$("User") to retrieve the current user's login ID.

How do I do this in WinXP??

Many thanks in advance.

Ed Metcalfe. Please do not feed the trolls.....
 
MsgBox("The current user is: " & CurrentUser)

CurrentUser function is a simple way that works for XP
 
Beeps,

Doesn't CurrentUser() return the current workgroup ID that the user is using? I was looking for the Windows user name.....

Ed Metcalfe. Please do not feed the trolls.....
 
try this?

'/*-/*-/-**/-/*-/*-/*-*/*-/*-/*-
'get username
Dim netw As Object

Set netw = CreateObject("WScript.Network")
myuser = netw.UserName
Set netw = Nothing
'/*-/-*/*/-*/*-/*-

-Tranpkp [yinyang] Tranpkp [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top