Hello All --
Sorry to be a pain but I am in need of some assistance on a weird request:
I have a form that has a unbound text field showing the current user logged in the computer utilizing the fosUserName()
I also have a tblUsers with the USER_NT field and AccessLevelID field.
What I need to have happen is that when a user clicks on a button that if the USER_NT field on the form and the USER_NT field in the tblUSERS match AND the AccessLevelID = 1 that it will open up another form, if it doesn't match or equal 1 then it will give a message "Administrator Only"
Is this possible in VB on the on click event?
Thanks in adavnce....
Sorry to be a pain but I am in need of some assistance on a weird request:
I have a form that has a unbound text field showing the current user logged in the computer utilizing the fosUserName()
Code:
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fosUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUsername As String
strUsername = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUsername, lngLen)
If (lngX > 0) Then
fosUserName = Left$(strUsername, lngLen - 1)
fosUserName = LCase(fosUserName)
Else
fosUserName = vbNullString
End If
End Function
I also have a tblUsers with the USER_NT field and AccessLevelID field.
What I need to have happen is that when a user clicks on a button that if the USER_NT field on the form and the USER_NT field in the tblUSERS match AND the AccessLevelID = 1 that it will open up another form, if it doesn't match or equal 1 then it will give a message "Administrator Only"
Is this possible in VB on the on click event?
Thanks in adavnce....