PC Review


Reply
Thread Tools Rate Thread

How to customize "access denied" message?

 
 
Craig
Guest
Posts: n/a
 
      2nd Apr 2008
Hello,

I'm using Access 2003 to develop a database with user-level security. I
have the ULS set up and everything is working well.

When a user attempts to open a form they don't have sufficient privileges to
open, they get the standard message: "You don't have permission to open
'frmForm'."

Is there any way (any property/setting/method/etc.) for me to customize that
message to provide a little more context? I'm afraid less-savvy users might
think that the database is broken, and not understand the real reason they're
getting that message.

Any help is greatly appreciated!

Thanks,
Craig
 
Reply With Quote
 
 
 
 
Keith Wilby
Guest
Posts: n/a
 
      2nd Apr 2008
"Craig" <(E-Mail Removed)> wrote in message
news:A5E4F0E9-A95B-45DC-8791-(E-Mail Removed)...
> Hello,
>
> I'm using Access 2003 to develop a database with user-level security. I
> have the ULS set up and everything is working well.
>
> When a user attempts to open a form they don't have sufficient privileges
> to
> open, they get the standard message: "You don't have permission to open
> 'frmForm'."
>
> Is there any way (any property/setting/method/etc.) for me to customize
> that
> message to provide a little more context?


You could use the CurrentUser function.

If CurrentUser = "Whatever" Then
MsgBox "Access dennied"
Docmd.Close Form, Me.Name
End If

You'd have to grant them permissions to open the form though.

Keith.
www.keithwilby.com

 
Reply With Quote
 
Craig
Guest
Posts: n/a
 
      2nd Apr 2008
"Keith Wilby" wrote:

> You could use the CurrentUser function.
>
> If CurrentUser = "Whatever" Then
> MsgBox "Access dennied"
> Docmd.Close Form, Me.Name
> End If
>
> You'd have to grant them permissions to open the form though.


Thanks --- I was hoping there was some kind of database setting or property
where the default "access denied" message comes from.

Or: Some function I could write that would apply to all access-denied
situations, rather than having to write it specifically to a particular user
or form.

Right now there are only a few users, but eventually it will probably grow
to about 25-30 people overall.

Thanks again,
Craig
 
Reply With Quote
 
david
Guest
Posts: n/a
 
      3rd Apr 2008
How are they opening the form? You have more control if you give
them a button to push instead of letting them select forms from the
database window.

(david)

"Craig" <(E-Mail Removed)> wrote in message
news:A5E4F0E9-A95B-45DC-8791-(E-Mail Removed)...
> Hello,
>
> I'm using Access 2003 to develop a database with user-level security. I
> have the ULS set up and everything is working well.
>
> When a user attempts to open a form they don't have sufficient privileges
> to
> open, they get the standard message: "You don't have permission to open
> 'frmForm'."
>
> Is there any way (any property/setting/method/etc.) for me to customize
> that
> message to provide a little more context? I'm afraid less-savvy users
> might
> think that the database is broken, and not understand the real reason
> they're
> getting that message.
>
> Any help is greatly appreciated!
>
> Thanks,
> Craig



 
Reply With Quote
 
Keith Wilby
Guest
Posts: n/a
 
      3rd Apr 2008
"Craig" <(E-Mail Removed)> wrote in message
news:C99B289B-F7D8-45A0-A1A7-(E-Mail Removed)...
> "Keith Wilby" wrote:
>
>> You could use the CurrentUser function.
>>
>> If CurrentUser = "Whatever" Then
>> MsgBox "Access dennied"
>> Docmd.Close Form, Me.Name
>> End If
>>
>> You'd have to grant them permissions to open the form though.

>
> Thanks --- I was hoping there was some kind of database setting or
> property
> where the default "access denied" message comes from.
>
> Or: Some function I could write that would apply to all access-denied
> situations, rather than having to write it specifically to a particular
> user
> or form.
>
> Right now there are only a few users, but eventually it will probably grow
> to about 25-30 people overall.


That's where generic user accounts come in. Instead of having a user
account for each user, consider having an account for each *group* of users,
for example "secretary" or "manager". The other option of course is to
design your GUI such that only valid users can navigate to that form in the
first place so that the error never occurs.

Regards,
Keith.

 
Reply With Quote
 
Craig
Guest
Posts: n/a
 
      3rd Apr 2008
"david" wrote:

> How are they opening the form? You have more control if you give
> them a button to push instead of letting them select forms from the
> database window.
>
> (david)


David,

When the database opens, a "main menu" switchboard form appears.

From that form they can click one of four buttons to open additional forms.
Depending on the user's role, he or she might have access to one, two, three,
or all four forms.

I've set up the security correctly and the generic system "access denied"
message appears at the correct moments --- I'd just like to customize that
message. Not a showstopper, just a nice-to-have.

Thanks,
Craig
 
Reply With Quote
 
Craig
Guest
Posts: n/a
 
      3rd Apr 2008
"Keith Wilby" wrote:

>
> That's where generic user accounts come in. Instead of having a user
> account for each user, consider having an account for each *group* of users,
> for example "secretary" or "manager". The other option of course is to
> design your GUI such that only valid users can navigate to that form in the
> first place so that the error never occurs.


Keith,

Your last reply got me thinking: Is there a function, similar to
CurrentUser, that refers to the security group?

I've set up the user-level security in my database so that I assign
permissions to groups, and then assign users to groups. It would be nice if
the function could check the group, rather than the user.

Thanks again,
Craig
 
Reply With Quote
 
Keith Wilby
Guest
Posts: n/a
 
      3rd Apr 2008
"Craig" <(E-Mail Removed)> wrote in message
news:A1367300-2417-427C-850C-(E-Mail Removed)...
> "Keith Wilby" wrote:
>
>>
>> That's where generic user accounts come in. Instead of having a user
>> account for each user, consider having an account for each *group* of
>> users,
>> for example "secretary" or "manager". The other option of course is to
>> design your GUI such that only valid users can navigate to that form in
>> the
>> first place so that the error never occurs.

>
> Keith,
>
> Your last reply got me thinking: Is there a function, similar to
> CurrentUser, that refers to the security group?
>
> I've set up the user-level security in my database so that I assign
> permissions to groups, and then assign users to groups. It would be nice
> if
> the function could check the group, rather than the user.
>


This function (written for A97 IIRC) returns True if CurrentUser is a member
of the group supplied as the argument:

Public Function libInGroup(ByVal strGroup As String) As Boolean
Dim ws As DAO.Workspace
Dim usr As DAO.User
Dim strUserName As String
Set ws = DBEngine(0)
strUserName = CurrentUser
For Each usr In ws.Groups(strGroup).Users
If usr.Name = strUserName Then
libInGroup = True
Exit Function
End If
Next
End Function

So maybe you could call that using something like:

If Not libInGroup("MyGroupName") Then
'Access denied
End If

Keith.

 
Reply With Quote
 
Joan Wild
Guest
Posts: n/a
 
      3rd Apr 2008
Craig, use Keith's function in the open event of your 'menu' form.

If Not libInGroup("MyGroupName") then
me!SomeButton.Visible = false
me!SomeOtherButton.Visible = false
etc.
end if

Then your users won't even see the buttons to forms they're not allowed into.

--
Joan Wild
Microsoft Access MVP
 
Reply With Quote
 
Keith Wilby
Guest
Posts: n/a
 
      3rd Apr 2008
> "Joan Wild" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> Craig, use Keith's function in the open event of your 'menu' form.
>
> If Not libInGroup("MyGroupName") then
> me!SomeButton.Visible = false
> me!SomeOtherButton.Visible = false
> etc.
> end if


> Then your users won't even see the buttons to forms they're not allowed
> into.


For that matter, you could use

Me.SomeButton.Visible = libInGroup("MyGroupName")

(I think! Not tested).

Keith.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Receive "Access is denied" error message multiple times =?Utf-8?B?c2N3aWxzb243Mg==?= Windows XP Help 2 21st Nov 2007 03:27 AM
"Access Denied" or "Permission Denied" Scripting Error Messages =?Utf-8?B?S2lyYW4gTWVuZG9u?= Windows XP Internet Explorer 2 4th Feb 2005 06:43 PM
ERROR MESSAGE "Access is denied" to install Service Pack 4 geno Microsoft Windows 2000 Setup 0 12th Mar 2004 09:05 PM
"Access Denied" or "Permission Denied" Scripting Error Messages If Automatic Configuration Customizes Zone Settings =?Utf-8?B?VkFOSUxMQQ==?= Windows XP Internet Explorer 0 3rd Mar 2004 12:11 PM
"Access Denied" or "Permission Denied" Scripting Error Messages If Automatic Configuration Customizes Zone Settings =?Utf-8?B?VkFOSUxMQQ==?= Windows XP Internet Explorer 0 3rd Mar 2004 12:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:53 PM.