Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2004
    Posts
    8

    Lightbulb Unanswered: personalizing the user level security

    hello again
    i'm just wondering if anyone knows any way to personalize a form with a user name from the user level security. i was thinking that maybe the user name is stored in a variable or something(probably not). but i was thinking of when the user opens the form, have maybe a label box that says, "Hello <username>!". Wouldn't that be awesome??!! just wondering if that's at all possible. thanks
    jacosta

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    What do you mean by user level security? Are you referring to the NT authentication/windows user name?

    If so:

    Code:
    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
    (ByVal lpBuffer As String, nSize As Long) As Long
    
    ---------
    Dim User As String
    Dim strUser As String
    Dim lngBufLen As Long
    strUser = String$(15, " ")
    lngBufLen = 15
    User = GetUserName(strUser, lngBufLen)
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jun 2004
    Posts
    8
    no, i was talking about the users and passwords you create in access in the "user level security wizard" under tools->security->User-Level-Security-Wizard. i didn't know that you can get the windows username. that's pretty cool. but i'm making a database for a college environment, where i want to track which users use the system, not which computer accesses it. does that make sense? thanks for your help. i'll probably use that code for something else, if i come up with any cool ideas. i've been on an access kick lately!!!

    thanks again
    jacosta

  4. #4
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    If there are user groups set up its even easier than that. It would be:


    MsgBox "Hello " & CurrentUser





    However if there is no user groups set up you have to do what the other person said.

  5. #5
    Join Date
    Jun 2004
    Posts
    8

    Thumbs up awesome!

    hey thanks for that little bit of code. it works great. i was wondering if there was a way to use the UserName variable anywhere, like in a label on a form? i tried to see if i could do it, but it didn't work.

    thanks a lot for your help
    jacosta

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    =CurrentUser ?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    Jun 2004
    Posts
    8
    duh. i'm an idiot. it's funny, it only works in a text box and not a label.
    cool thanks

  8. #8
    Join Date
    Jun 2004
    Posts
    8
    nevermind. i figured that out too. i put "Hello " & CurrentUser in a textbox under formload! that's great

Posting Permissions

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