Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Apr 2001
    Thanked 0 Times in 0 Posts

    How to determine system ID (A2K SP1)

    I would like to be able to determine whether an Access database is being opened from the development PC or a user PC. How can I examine a field that will allow me to determine the identity of the PC that opened the database?

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Edmonton, Alberta, Canada
    Thanked 0 Times in 0 Posts

    Re: How to determine system ID (A2K SP1)

    If you're running Windows NT or 2000 you can get the name of the computer with

    <pre>Private Declare Function apiGetComputerName Lib "kernel32" Alias _
    "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    Function ap_GetUserName() As Variant
    'Returns the Windows NT login user name (NOT the Access user name).
    Dim strUserName As String 'User name as returned by GetUserNameA dll routine. Includes trailing null
    Dim lngLength As Long 'Length of returned user name (including null)
    Dim lngResult As Long 'Placeholder. Not used.

    'set up the buffer
    strUserName = String$(255, 0)
    lngLength = 255

    'make the call to the dll GetUserNameA routine
    lngResult = wu_GetUserName(strUserName, lngLength) 'lngResult intentionally ignored.

    'assign the value. Last character is always a null, so we trim it off.
    ap_GetUserName = Left(strUserName, lngLength - 1)

    End Function</pre>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts