All of the Department heads want there finance reports for their department password protected so know one outside the department can review their finances. So I attach some code to the open button. It works (that is keeps others out) but the after you hit okay (if you don't have access to that report) it comes up with an error MSG. But it lets you proceed on. I just hate that error MSG. Can anyone help me correct this problem with my code please....
Option Compare Database
Option Explicit
Private Sub Report_Open(Cancel As Integer)
On Error GoTo ErrFO
If ((CurrentUser() <> "phm2600a" And (CurrentUser() <> "phm7674b" And (CurrentUser() <> "phm0000" And (CurrentUser() <> "phm0000") Then
MsgBox "ACCESS DENIED."
Cancel = True
End If
ExitFO:
Exit Sub
ErrFO:
MsgBox Err.Description, vbInformation, "Report Open Error."
Resume ExitFO
End Sub
Option Compare Database
Option Explicit
Private Sub Report_Open(Cancel As Integer)
On Error GoTo ErrFO
If ((CurrentUser() <> "phm2600a" And (CurrentUser() <> "phm7674b" And (CurrentUser() <> "phm0000" And (CurrentUser() <> "phm0000") Then
MsgBox "ACCESS DENIED."
Cancel = True
End If
ExitFO:
Exit Sub
ErrFO:
MsgBox Err.Description, vbInformation, "Report Open Error."
Resume ExitFO
End Sub