I have code set up that establishes the username and decides if that user is allowed to go into the database, it works via the event of the switchboard form opening.
i want to email the username of people that are refused entry to someone so they can keep tabs on attempts at unauthorised entry.
the 2 bits of code are -
Function Get_User_Name()
Dim lpBuff As String * 25
Dim z As String
Dim ret As Long
ret = GetUserName(lpBuff, 25)
username = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
z = username
End Function
and
Sub Form_Open(Cancel As Integer)
Get_User_Name
If username = "joe.brown" Then
Exit Sub
ElseIf username = "john.smith" Then
Exit Sub
ElseIf username = "jane.thomas" Then
Exit Sub
Else
MsgBox "Sorry you are not authorised to go in here ", vbExclamation,
Application.Quit
End If
i want to email the username of people that are refused entry to someone so they can keep tabs on attempts at unauthorised entry.
the 2 bits of code are -
Function Get_User_Name()
Dim lpBuff As String * 25
Dim z As String
Dim ret As Long
ret = GetUserName(lpBuff, 25)
username = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
z = username
End Function
and
Sub Form_Open(Cancel As Integer)
Get_User_Name
If username = "joe.brown" Then
Exit Sub
ElseIf username = "john.smith" Then
Exit Sub
ElseIf username = "jane.thomas" Then
Exit Sub
Else
MsgBox "Sorry you are not authorised to go in here ", vbExclamation,
Application.Quit
End If