Re: Txt and users levels?
- From: "Albert D. Kallal" <PleaseNOOOsPAMmkallal@xxxxxxx>
- Date: Wed, 6 Aug 2008 06:24:34 -0600
<d9pierce@xxxxxxxxx> wrote in message
news:92c3ab51-4731-4496-8660-732176c6193f@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,
Is there a way to display on forms a message "You have permission to
unlock records" & "You do not have permission to unlock records"
depending on user levels?
Yes, when you open the form, in the forms on-load event you could put the
following code:
if IsInGroup(CurrentUser,"SuperUser" then
me.txtMsg = "You have permission to unlock records"
else
me.txtMsg = "You have permission to unlock records"
end if
The above example assumes you have a un-bound text box on the form called
txtMsg, and the user is a member of the security group called "SuperUser".
Of course you replace "SuperUser" with the name you used for the security
group that a person is a member of that allows edits (and, change the name
of txtMsg to the name of the text box you choose on your form.
The funciton IsInGroup is not built into ms-access, but the code for that is
easy. Simply place the follow code in a standard public module (not the
forms module)
Public Function IsInGroup(UsrName As String, GrpName As String) As Boolean
'Determines whether UsrName is a member of a security group GrpName
Dim grp As Group
Dim IIG As Boolean
Dim usr As user
IIG = False
For Each usr In DBEngine.Workspaces(0).Users
If usr.Name = UsrName Then GoTo FoundUser
Next
GoTo IIG_Exit
FoundUser:
For Each grp In usr.Groups
If grp.Name = GrpName Then IIG = True
Next
IIG_Exit:
IsInGroup = IIG
End Function
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@xxxxxxx
.
- Follow-Ups:
- Re: Txt and users levels?
- From: d9pierce@xxxxxxxxx
- Re: Txt and users levels?
- References:
- Txt and users levels?
- From: d9pierce@xxxxxxxxx
- Txt and users levels?
- Prev by Date: lstbox and users
- Next by Date: Re: lstbox and users
- Previous by thread: Txt and users levels?
- Next by thread: Re: Txt and users levels?
- Index(es):
Relevant Pages
|