So this may seem trivial to some, but this is getting the best of me.
Setup:
I am building a database for a client and I have the need for a lengthy validation process. There is a form "frm_StationSettings" that is linked to a table "tbl_StationSettings". The VBA is fired off a _Click event on a form used to log into the different 'stations' located in their different offices. When clicked, the form checks the table to see if the station is in 'lockout' mode. If the *_Lockout.value on the table is true, then, instead of showing the regular form for their office, it shows a 'lockout' form. I am not sure why he wants it in there, or what he is going to accomplish with it in there, but he wants it.
Here is the code I can not get to work. This is only two of 7 stations I have to insert into the _Click event. I keep getting block/end if errors. When nesting IF statements like this, I am just confused.
Code:
Private Sub cmdLogin_Click()
If cboPortal.Value = "Administrator" And txtPassword.Value = "OSMGowns" Then
If [Tables]![tbl_StationSettings]![Administrator_Lockout].Value = True Then
cboPortal.Value = Null
txtPassword.Value = Null
DoCmd.Close
DoCmd.OpenForm "lockout"
Else: cboPortal.Value = Null
txtPassword.Value = Null
DoCmd.Close
DoCmd.OpenForm "LoggedIn_Administrator", acNormal, , , , acWindowNormal
If cboPortal.Value = "Office Staff" And txtPassword.Value = "OSMGowns" Then
If [Tables]![tbl_StationSettings]![OfficeStaff_Lockout].Value = True Then
cboPortal.Value = Null
txtPassword.Value = Null
DoCmd.Close
DoCmd.OpenForm "lockout"
Else: cboPortal.Value = Null
txtPassword.Value = Null
DoCmd.Close
DoCmd.OpenForm "LoggedIn_OfficeStaff", acNormal, , , , acWindowNormal
Else: MsgBox "Invalid Athentication Provided." & vbCrLf & "Please try again!", vbInformation, "Please Try Again!"
End If
End Sub
Thank you in advance for any help. Let me know if you need anymore information!
-Joel