Computer Name

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Good Morning,

Can anyone tell me how I can determine the name of a
computer my Access database is being accessed from. I have
an Access split database application with the database
existing on a network drive and the forms, code modules,
etc. remaining on the users computer. I want to be able to
log the computer name and network address if possible of a
computer accessing the database.

Thanks in advance!

Kevin
 
Put this code in a Access Module.

use it from your form like debug.print GetComputerName()


Public Declare Function apiGetComputerName Lib "kernel32" Alias _
"GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long


Function GetComputerName() As String
Dim lngLen As Long, lngX As Long
Dim strName As String

lngLen = 32
strName = String$(lngLen, 0)
lngX = apiGetComputerName(strName, lngLen)
If lngX <> 0 Then
GetComputerName = Left$(strName, lngLen)
Else
GetComputerName = ""
End If
End Function

Ron W
 
Back
Top