Error Message

S

stevenzk

I have add a user to a user group that had some read acces
restriction.

When the user open the restricted form, a error message will appea
showing "You don't have permission to run form1."

Is it possible to edit the code of the messagebox that after the use
click the ok button it will open up a form i wanted
 
T

TC

Maybe something like this. It tries to open form1, but if th user is
not allowed to do that, it isplays a message & then opens form 2.

(UNTESTED)

on error resume next
docmd.openform "form1"
select case err.number
case 0 ' form opened ok.
case 999 ' user not allowed.
on error goto 0
msgbox "Sorry, you do not have permission to open that form"
docmd.openform "form2"
case else ' unexpected error.
msgbox "Error " & err.number & ": " & err.description
end select
on error goto 0

In that code, you would have to replace 999 with the actual error
number that occurs when the user does not have permission to open the
form. I don't know what that number is, off-hand. You could find it out
by temporarily adding the following line before the 'select case'
statement: msgbox err.number

HTH,
TC
 
S

stevenzk

I give up this method and use another way to do it.

Thanks a lot for the information.

Appreciate it
 

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