Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trap Permissions Error

Security Permissions

Trap Permissions Error

by  Garridon  Posted    (Edited  )
If you're using Microsoft Security to protect your database, some of your users will get a standard message box when they try to open a form they don't have authorization to access. This traps the error and provides a chance for you customize the message.

Insert this code into the on click procedure of the button that opens the form.

Private Sub cmdbutton_Click()
On Error GoTo ErrorcmdButton

DoCmd.OpenForm "frmName", acNormal

ExitcmdButton:
Exit Sub

ErrorcmdButton:

' Traps permissions error message
If Err = 2603 Then

MsgBox "You do not have access to this department's records"
Resume ExitcmdButton

End If

End Sub

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top