Hi,
So I have a Main switchboard that has 5 buttons that all lead to more switchboards (all are created using the switchboard manager). There are 4 buttons that everyone in the company department needs to access and then there is an administrator button. I need to password protect the administrator button so that when the correct password is entered the Admin switchboard page opens. Right now I have a form called frmPassword and the action when the admin button is clicked opens frmPassword. There are two buttons on frmPassword, Enter and Cancel. The enter button has this on click event:
Private Sub cmdShowAdminArea_Click()
On Error GoTo ErrorPoint
If Len(Nz(Me!txtPassword, "")) = 0 Then
MsgBox "Please enter a password before continuing." _
, vbCritical, "Missing Password"
Me.txtPassword.SetFocus
Else
If Me.txtPassword <> "MyPassword" Then
' just an example password
MsgBox "Incorrect Password", vbExclamation, "Access Denied"
DoCmd.close acForm, "frmPassword"
Else
Forms!Switchboard.Filter = "[ItemNumber] = 0 And [SwitchboardID] = 7"
Me.FilterOn = True
Forms!Switchboard.Refresh
DoCmd.close acForm, "frmPassword"
End If
End If
ExitPoint:
Exit Sub
ErrorPoint:
' Unexpected Error
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint
End Sub
When Access goes through the code it basically just passes over the part highlighted in red because it doesn't go to that page. In the Switchboard Table the admin switchboard and the buttons on it are denoted by:
SwitchboardID ItemNumber ItemText Command Argument
7 0 Administrator 0
7 1 Go Back 1 1
7 2 Records 1 8
7 3 Stand. 1 9
7 4 Inst. 1 14
7 5 Close 6
So basically my problem is getting the Adminstrator switchboard page to open when the correct password is used because right now all the happends when the correct password is used is that frmPassword closes.
Please help!!!
Thanks!!!!!!!!!!!!!!!!!