Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Location
    Seattle
    Posts
    18

    Unanswered: switchboard/based on Win XP login

    I want to use more than one switchboard/menu.
    This should be based on the user login in Windows XP.

    There must be some way to call from Access 2002 to XP (& get that data), and then direct the user to the appropriate switchboard/menu.

    Thanks, in advance, for any help.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Sure, you can pull the NT Authentication into a global variable with this code:

    Code:
    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
    (ByVal lpBuffer As String, nSize As Long) As Long
    
    Your Sub ()
    Dim IsUser As String
    Dim strUser As String
    Dim lngBufLen As Long
    
    strUser = String$(15, " ")
    lngBufLen = 15
    IsUser = GetUserName(strUser, lngBufLen)
    
    If IsUser Then
        ntUser = Left$(Trim(strUser), Len(Trim(strUser)) - 1)
    Else
        'error handling here, I usually have a "contact it" and docmd.quit here
    End If
    End Sub
    After you've executed the sub, you can reference the user name via 'ntUser'. In your case, you could have a macro that executes this code on startup and opens an approriate switchboard based on the ntUser value.
    Last edited by Teddy; 03-08-04 at 17:35.

  3. #3
    Join Date
    Jul 2003
    Location
    Earth | North America | United States | California | Long Beach
    Posts
    62
    This is great. This will solve a problem that I am having as well.

    However, can you help me.

    I am not sure which library reference I need to check in order to utilize this code.

    Thanks for your help.

    Jack

  4. #4
    Join Date
    Mar 2004
    Location
    Seattle
    Posts
    18
    Teddy,

    Thanks for your reply.
    Is this code also good for Windows XP?

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by meircha
    Teddy,

    Thanks for your reply.
    Is this code also good for Windows XP?
    Yes. I am currently using the above code in a 2kserver domain with XP clients.

Posting Permissions

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