Find user's machine name

K

K

Hi all, I got macro below which tell me user's computer name who is
logged on in current database. What changes I do in below macro that
it should tell me the user's machine name who is logged on in the
database which is on path "C:\Documents\Record.mdb". Please can any
friend can help

Private Declare Function apiGetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Function fOSMachineName() As String 'Returns the computername

Dim lngLen As Long, lngX As Long
Dim strCompName As String
strCompName = String$(16, 0)
lngLen = 16
lngX = apiGetComputerName(strCompName, lngLen)
If (lngX > 0) Then
fOSMachineName = Left$(strCompName, lngLen)
Else
fOSMachineName = vbNullString
End If
End Function
 

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

Similar Threads


Top