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
What do you mean by user level security? Are you referring to the NT authentication/windows user name?
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)
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!!!
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.