Good code to return current logged on user here:
http://www.mvps.org/vbnet/
Regards Alan
Main Topics
Browse All Topics(This is a data access page, btw, so I can't use the currentUser function).
>MsgBox MSODSC.Connection.Properti
is linked to a button.
Right now, I have 3 usernames: Admin, Subordinate01, 93821
When the button is clicked, no matter who I'm logged into the database as, it always and only returns "Admin". Does anyone know why? Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Good code to return current logged on user here:
http://www.mvps.org/vbnet/
Regards Alan
Please dis-regard my previous post, only works in VB6
This works in Access:
'In a new module paste the following
'Usage: YourFieldname = GetUserName()
'Returns: Alan
Private Declare Function WNetGetUser& Lib "Mpr" Alias "WNetGetUserA" (lpName As Any, ByVal lpUserName$, lpnLength&)
Public Function GetUserName() As String
Dim ret As Long
Dim cbusername As Long
Dim username As String
username = ""
username = Space(256)
cbusername = Len(username)
ret = WNetGetUser(ByVal 0&, username, cbusername)
If ret = 0 Then
username = Left(username, InStr(username, Chr(0)) - 1)
Else
username = ""
End If
GetUserName = username
End Function
Regards Alan
Updated function getUserName() available at:
http://www.cashoz.com/samp
Regards Alan
Business Accounts
Answer for Membership
by: foresterPosted on 2003-07-01 at 17:43:13ID: 8836448
Yes, the reason is that the user is using a PC that does have a user profile system set up on it, and therefore, does not require him or her to enter a name. The default name of any PC user whose PC lacks "profiles" is simply "Admin."