Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Find user's machine name

0 views
Skip to first unread message

K

unread,
Dec 8, 2009, 5:01:35 AM12/8/09
to
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

Arvin Meyer [MVP]

unread,
Dec 8, 2009, 4:46:21 PM12/8/09
to
Same code. The code below is not specific to any database, it is specific to
that particular computer. The code uses a Windows API and has nothing to do
with Access, other than that's where it's running from. You could run it
from Excel as well.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"K" <kamra...@yahoo.co.uk> wrote in message
news:61c6947c-3786-444c...@l13g2000yqb.googlegroups.com...

0 new messages