By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,315 Members | 1,611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,315 IT Pros & Developers. It's quick & easy.

Username of XP login

P: n/a
I am using access2003 and need to find out the userid of the person who
has logged into the machine. Can someone direct to a code or help
please.

TIA.

Ninad

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I use the following with XP:

Option Compare Database

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias
"GetUserNameA" _
(ByVal lpBuffer As String, nSize As Long) As Long

'-----------------------------------------------------------------------------------------
' This code is used to retrieve the network user name by accessing the API
apiGetUserName.
' Created by: Unknown (Found on Dev Ashish web site
http://home.att.net/~dashish/api)
' This code has not been altered in anyway.
' Added to database: 27 dec 1999
' Added by: Richard Rensel
'-----------------------------------------------------------------------------------------

Function fOSUserName() As String
On Error GoTo fOSUserName_Err

Dim lngLen As Long, lngX As Long
Dim strUserName As String

strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)

If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
fOSUserName_Exit:
Exit Function

fOSUserName_Err:
MsgBox Error$
Resume fOSUserName_Exit
End Function
"Ninad" <ni****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I am using access2003 and need to find out the userid of the person who
has logged into the machine. Can someone direct to a code or help
please.

TIA.

Ninad

Nov 13 '05 #2

P: n/a
Try this one:
http://www.mvps.org/access/api/api0008.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Ninad" <ni****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I am using access2003 and need to find out the userid of the person who
has logged into the machine. Can someone direct to a code or help
please.

Nov 13 '05 #3

P: n/a
Many thanks Allen. I visited the page earlier but somehow I overlooked
this function.

Ninad.

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.