Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: How to determine user identity


Message #1 by "Jim Wilson" <jrwilson@c...> on Thu, 18 Jul 2002 20:33:12
How can I determine the user's identity based on their sign-on?  We are on 
a Novell LAN and we have Windows 95b, 98 and 2000 Professional operating 
systems.
Message #2 by PStreeter@C... on Thu, 18 Jul 2002 13:58:06 CST
On Thu, 18 Jul 2002 20:33:12 "Jim Wilson" wrote:

> How can I determine the user's identity based on their sign-on?  We
> are on 
> a Novell LAN and we have Windows 95b, 98 and 2000 Professional operating 
> systems.
Put this in a module:
Option Compare Database
Option Explicit

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

Function get_username() As String
    Dim lpBuff As String * 25
    Dim ret As Long
    Dim Username As String

        ret = GetUserName(lpBuff, 25)
        Username = VBA.Left(lpBuff, VBA.InStr(lpBuff, VBA.Chr(0)) - 1)

    get_username = VBA.UCase(Username)
End Function

The function get_username() will supply the username. I.E. in a
text box, "=get_username()" will display the username on the 
form or report.

Paul


Message #3 by "Chris Seier" <eagle2769@y...> on Sat, 20 Jul 2002 04:43:46
> How can I determine the user's identity based on their sign-on?  We are on 
a>  Novell LAN and we have Windows 95b, 98 and 2000 Professional operating 
s> ystems.

Here's how I do it:
Run the "Set" command from the command prompt. This will tell you your
environmental settings.

I used the following before update code on a DB for my wife:
Me.[Record Updated] = Now               'Time and user stamp record updates.
Me.[User Updated] = Environ("USERNAME")

In my wife's case I used "USERNAME" because that's what the "Set" command
reported as containing her username.

Chris

  Return to Index