Results 1 to 2 of 2

Thread: Access Greeter

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2000
    Posts
    19

    Unhappy

    Help!! How do I get a user currently signed on to thier NT 4.0 machine when the a customized "greeting" form in Access 2000 pops up?

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I'm not sure that I understand your question but if it's the user name you want you can do this in two ways on WinNT and Win2000.

    The first is to call the GetUserName API function:
    Code:
    Public Declare Function GetUserName _
     Lib "advapi32.dll" Alias "GetUserNameA" ( _
     ByVal lpBuffer As String, _
     nSize As Long) As Long
    
    Public Function GetCurrentUser() As String
        Dim sUserName As String
    
        sUserName = Space$(250)
        Call GetUserName(sUserName, Len(sUserName))
        sUserName = Left$(sUserName, Instr(sUserName, vbNullChar) - 1)
        GetCurrentUser = sUserName
    End Function
    This will work on all Windows OS.
    The second way will only work on WinNT and Win2000 and that is to check the UserName environment variable:
    Code:
    Public Function GetCurrentUser() As String
        GetCurrentUser = Environ("UserName")
    End Function
    Good luck!

Posting Permissions

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



Click Here to Expand Forum to Full Width