Run Time Error 2603

D

dan.cawthorne

How do change the error message thats prompted when a User opens a
form that they don't have permission to open

instead of the standard end and debug buttons on the menu with the
error run time error 2603 been displayed

i just want a simple message box that with a OK button on it.

ive tried putting some code on the on error event of the form, from
another article but not luck.

i tried following.

Private Sub Form_Error(DataErr As Integer, Response As Integer)

On Error GoTo Errorfnc_mnuOpen_Err

Errorfnc_mnuOpen_Err:
If Err = 2603 Then

If MsgBox("You do not have the necessary permissions to_ view
this menu option. Consult your system administrator") = vbOK Then
'simply end the function
End If
Exit Function ' if it's a sub then Exit Sub
End If

End Sub

This code dose not have any effect.

My form im opening from via command button is MainMenu and the Command
Button opens a form called "Admin_Menu"

or my route was when users if a certain group, logged in would not be
able to see the button that opens the "Admin_Menu"

So on the Mainmenu Open Eevent I tried

If faq_IsUserInGroup("Users",CurrentUser) then
Me.Command08.Visible = False
Else
Me.Command08.Visible = True
End If

But This Don't work either
 
D

dan.cawthorne

Well I've tried both pieces of code and still cant them to work in the
On Error event or on Open Event

Not worry now, I've managed to find a solution now, if any one needs
it its

Need to go on the command button Click event of the form that its
going open thats protected.

Private Sub cmdbutton_Click()
On Error GoTo ErrorcmdButton

DoCmd.OpenForm "Admin_Menu", acNormal
DoCmd.Close acForm, "MainMenu"

ExitcmdButton:
Exit Sub

ErrorcmdButton:

' Traps permissions error message
If Err = 2603 Then

MsgBox "You do not have access to this Section"
Resume ExitcmdButton

End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top