I will try to be short winded.
I have a databse that works. However, I want to open a different form if the user is admin (username admin) than all the other users.
What I have does not work. It opens the regular form that all the others use.
Regular user form = time
admin form = timeadmin
On got focus the following code runs:
Me.Requery
If [Forms]![login]![pwcheck] = [Forms]![login]![PW] And [Forms]![login]![userid] = "Admin" Then
DoCmd.OpenForm "timeadmin"
Cancel = True
If [Forms]![login]![pwcheck] <> [Forms]![login]![PW] Then
MsgBox "Please Try Again", vbOKOnly, "Invalid Password or USER ID!"
Cancel = True
End If
If Me.PW = "password" Then
MsgBox "This is the first time using the database or your passowrd has been reset." & Chr(13) & _
"You must change your password before you can enter the database.", _
vbOKOnly + vbExclamation, "Change Password"
DoCmd.OpenForm "chgpw"
End If
ElseIf [Forms]![login]![pwcheck] = [Forms]![login]![PW] Then
Dim stDocName As String
stDocName = "TIME"
DoCmd.OpenForm stDocName
Cancel = True
End If
Exit_Command12_GotFocus:
Exit Sub
Err_Command12_GotFocus:
MsgBox "Your Not in The Database", vbOKOnly, "Exiting Database Goodbye!"
Cancel = True
DoCmd.Quit
End Sub
I've been going in circles for hours. Please help me. My brain hurts.

I have a databse that works. However, I want to open a different form if the user is admin (username admin) than all the other users.
What I have does not work. It opens the regular form that all the others use.
Regular user form = time
admin form = timeadmin
On got focus the following code runs:
Me.Requery
If [Forms]![login]![pwcheck] = [Forms]![login]![PW] And [Forms]![login]![userid] = "Admin" Then
DoCmd.OpenForm "timeadmin"
Cancel = True
If [Forms]![login]![pwcheck] <> [Forms]![login]![PW] Then
MsgBox "Please Try Again", vbOKOnly, "Invalid Password or USER ID!"
Cancel = True
End If
If Me.PW = "password" Then
MsgBox "This is the first time using the database or your passowrd has been reset." & Chr(13) & _
"You must change your password before you can enter the database.", _
vbOKOnly + vbExclamation, "Change Password"
DoCmd.OpenForm "chgpw"
End If
ElseIf [Forms]![login]![pwcheck] = [Forms]![login]![PW] Then
Dim stDocName As String
stDocName = "TIME"
DoCmd.OpenForm stDocName
Cancel = True
End If
Exit_Command12_GotFocus:
Exit Sub
Err_Command12_GotFocus:
MsgBox "Your Not in The Database", vbOKOnly, "Exiting Database Goodbye!"
Cancel = True
DoCmd.Quit
End Sub
I've been going in circles for hours. Please help me. My brain hurts.