rodrunner79
IS-IT--Management
Hi guys,
I have a startup form that prompts user to login, the values from this form are from a table (table of users).
When the user log's in successfully, I want the database to remember who that user is? So I can pull his/her name from any form I want. Just like how the CurrentUser() function works when using Access Security. The reason for this is I'm trying to create a audit table, and I want to be able to pull this name when I need to audit something. How do I begin?
I have a startup form that prompts user to login, the values from this form are from a table (table of users).
Code:
Private Sub cmdLogIn_Click()
If LOGIN1 = 1 Then
Do While flag = False
If txtUserName.Value = User.Value And txtUserPass.Value = Password.Value Then
flag = True
MsgBox "Welcome " & User.Value & " to Inventory Tracer 2.01"
DoCmd.Close
DoCmd.OpenForm "Main Switchboard"
Else
If User.Value <> "" Then
DoCmd.GoToRecord , , acNext
Else
MsgBox "Please try again or contact your System Administrator"
DoCmd.GoToRecord , , acFirst
flag = True
End If
End If
Loop
Else
Do While flag = False
If txtUserName.Value = User.Value And txtUserPass.Value = Password.Value And txtLevel.Value >= 99 Then
flag = True
MsgBox "Welcome " & User.Value & " to Inventory Tracer 2.01"
DoCmd.Close
DoCmd.OpenForm "Administration"
Else
If User.Value <> "" Then
DoCmd.GoToRecord , , acNext
Else
MsgBox "You don't have access System Administration", vbOKOnly, "Sorry"
DoCmd.GoToRecord , , acFirst
DoCmd.Close
flag = True
End If
End If
Loop
End If
End Sub
When the user log's in successfully, I want the database to remember who that user is? So I can pull his/her name from any form I want. Just like how the CurrentUser() function works when using Access Security. The reason for this is I'm trying to create a audit table, and I want to be able to pull this name when I need to audit something. How do I begin?