Group:  Microsoft Access ยป microsoft.public.access.security
Thread: If faq_IsUserInGroup Syntax for three groups.

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

If faq_IsUserInGroup Syntax for three groups.
Olu Solaru 20.07.2006 18:50:02
I writing my code that will enable/disable controls based on the user groups.
What I am finding is that when I set my code for one particular groups it
affects the other groups. So my question is, will I have to use the If
faq_IsUserInGroup statement for all of my groups?

For example,

I have 7 controls on my form.

I have the Admin, Manufacturing, and Regulatory group.

I have set my coding as follows:
If faq_IsUserInGroup("Admins", CurrentUser) Then
Me.Add_Review_Employee_Information.Visible .... (For the admin group, my
intention is to make all the controls visibile - Am I going in the right
direction?)

If faq_IsUserInGroup("Regulatory", CurrentUser) Then
Me.Add_Review_Employee_Information.Visible = True
Me.cmdViewTraining.Visible = True
Me.cmdReviseSops.Visible = True
Me.cmdAddBpr.Visible = True
Me.cmdRunReports.Visible = True
Me.cmdAddLotNumber.Visible = True
Me.cmdExit.Visible = True
Else
Me.cmdAddLotNumber.Visible = False
End If

If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
Me.cmdRunReports.Visible = True
Me.cmdAddLotNumber.Visible = True
Me.cmdExit = True
Else
Me.Add_Review_Employee_Information.Visible = False
Me.cmdAddBpr.Visible = False
Me.cmdReviseSops.Visible = False
Me.cmdViewTraining.Visible = False
End If




End Sub

RE: If faq_IsUserInGroup Syntax for three groups.
Olu Solaru 20.07.2006 19:45:02
Another question - Can I make a reference to DAO objects in Access
2003/WinXp, as oppose to ADO?

"Olu Solaru" wrote:

[Quoted Text]
> I writing my code that will enable/disable controls based on the user groups.
> What I am finding is that when I set my code for one particular groups it
> affects the other groups. So my question is, will I have to use the If
> faq_IsUserInGroup statement for all of my groups?
>
> For example,
>
> I have 7 controls on my form.
>
> I have the Admin, Manufacturing, and Regulatory group.
>
> I have set my coding as follows:
> If faq_IsUserInGroup("Admins", CurrentUser) Then
> Me.Add_Review_Employee_Information.Visible .... (For the admin group, my
> intention is to make all the controls visibile - Am I going in the right
> direction?)
>
> If faq_IsUserInGroup("Regulatory", CurrentUser) Then
> Me.Add_Review_Employee_Information.Visible = True
> Me.cmdViewTraining.Visible = True
> Me.cmdReviseSops.Visible = True
> Me.cmdAddBpr.Visible = True
> Me.cmdRunReports.Visible = True
> Me.cmdAddLotNumber.Visible = True
> Me.cmdExit.Visible = True
> Else
> Me.cmdAddLotNumber.Visible = False
> End If
>
> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
> Me.cmdRunReports.Visible = True
> Me.cmdAddLotNumber.Visible = True
> Me.cmdExit = True
> Else
> Me.Add_Review_Employee_Information.Visible = False
> Me.cmdAddBpr.Visible = False
> Me.cmdReviseSops.Visible = False
> Me.cmdViewTraining.Visible = False
> End If
>
>
>
>
> End Sub
>
Re: If faq_IsUserInGroup Syntax for three groups.
"Joan Wild" <jwild[ at ]nospamtyenet.com> 20.07.2006 20:02:29
I have never set a reference to ADO, since all my databases use Jet as the
backend. If you don't need ADO then set the reference to DAO.

As for your code, I assume that a user can be a member of only one group.
Looking at your if statements, it appears that the Admins group and the
Regulatory group can see all buttons, but the Manufacturing group can only
see
cmdRunReports
cmdAddLotNumber
cmdExit
Post back if I've missed it...

If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
Me.cmdRunReports.Visible = True
Me.cmdAddLotNumber.Visible = True
Me.cmdExit = True
Me.Add_Review_Employee_Information.Visible = False
Me.cmdAddBpr.Visible = False
Me.cmdReviseSops.Visible = False
Me.cmdViewTraining.Visible = False
Else
Me.Add_Review_Employee_Information.Visible = True
Me.cmdViewTraining.Visible = True
Me.cmdReviseSops.Visible = True
Me.cmdAddBpr.Visible = True
Me.cmdRunReports.Visible = True
Me.cmdAddLotNumber.Visible = True
Me.cmdExit.Visible = True
End If

This would mean anyone in the Manufacturing group will see only three
buttons, if the current user isn't in the Manufacturing group, they'll see
them all. Is that what you want?

--
Joan Wild
Microsoft Access MVP

Olu Solaru wrote:
[Quoted Text]
> Another question - Can I make a reference to DAO objects in Access
> 2003/WinXp, as oppose to ADO?
>
> "Olu Solaru" wrote:
>
>> I writing my code that will enable/disable controls based on the
>> user groups. What I am finding is that when I set my code for one
>> particular groups it affects the other groups. So my question is,
>> will I have to use the If faq_IsUserInGroup statement for all of my
>> groups?
>>
>> For example,
>>
>> I have 7 controls on my form.
>>
>> I have the Admin, Manufacturing, and Regulatory group.
>>
>> I have set my coding as follows:
>> If faq_IsUserInGroup("Admins", CurrentUser) Then
>> Me.Add_Review_Employee_Information.Visible .... (For the admin
>> group, my intention is to make all the controls visibile - Am I
>> going in the right direction?)
>>
>> If faq_IsUserInGroup("Regulatory", CurrentUser) Then
>> Me.Add_Review_Employee_Information.Visible = True
>> Me.cmdViewTraining.Visible = True
>> Me.cmdReviseSops.Visible = True
>> Me.cmdAddBpr.Visible = True
>> Me.cmdRunReports.Visible = True
>> Me.cmdAddLotNumber.Visible = True
>> Me.cmdExit.Visible = True
>> Else
>> Me.cmdAddLotNumber.Visible = False
>> End If
>>
>> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
>> Me.cmdRunReports.Visible = True
>> Me.cmdAddLotNumber.Visible = True
>> Me.cmdExit = True
>> Else
>> Me.Add_Review_Employee_Information.Visible = False
>> Me.cmdAddBpr.Visible = False
>> Me.cmdReviseSops.Visible = False
>> Me.cmdViewTraining.Visible = False
>> End If
>>
>>
>>
>>
>> End Sub


Re: If faq_IsUserInGroup Syntax for three groups.
Olu Solaru 20.07.2006 20:09:01
That is correct.

"Joan Wild" wrote:

[Quoted Text]
> I have never set a reference to ADO, since all my databases use Jet as the
> backend. If you don't need ADO then set the reference to DAO.
>
> As for your code, I assume that a user can be a member of only one group.
> Looking at your if statements, it appears that the Admins group and the
> Regulatory group can see all buttons, but the Manufacturing group can only
> see
> cmdRunReports
> cmdAddLotNumber
> cmdExit
> Post back if I've missed it...
>
> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
> Me.cmdRunReports.Visible = True
> Me.cmdAddLotNumber.Visible = True
> Me.cmdExit = True
> Me.Add_Review_Employee_Information.Visible = False
> Me.cmdAddBpr.Visible = False
> Me.cmdReviseSops.Visible = False
> Me.cmdViewTraining.Visible = False
> Else
> Me.Add_Review_Employee_Information.Visible = True
> Me.cmdViewTraining.Visible = True
> Me.cmdReviseSops.Visible = True
> Me.cmdAddBpr.Visible = True
> Me.cmdRunReports.Visible = True
> Me.cmdAddLotNumber.Visible = True
> Me.cmdExit.Visible = True
> End If
>
> This would mean anyone in the Manufacturing group will see only three
> buttons, if the current user isn't in the Manufacturing group, they'll see
> them all. Is that what you want?
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Olu Solaru wrote:
> > Another question - Can I make a reference to DAO objects in Access
> > 2003/WinXp, as oppose to ADO?
> >
> > "Olu Solaru" wrote:
> >
> >> I writing my code that will enable/disable controls based on the
> >> user groups. What I am finding is that when I set my code for one
> >> particular groups it affects the other groups. So my question is,
> >> will I have to use the If faq_IsUserInGroup statement for all of my
> >> groups?
> >>
> >> For example,
> >>
> >> I have 7 controls on my form.
> >>
> >> I have the Admin, Manufacturing, and Regulatory group.
> >>
> >> I have set my coding as follows:
> >> If faq_IsUserInGroup("Admins", CurrentUser) Then
> >> Me.Add_Review_Employee_Information.Visible .... (For the admin
> >> group, my intention is to make all the controls visibile - Am I
> >> going in the right direction?)
> >>
> >> If faq_IsUserInGroup("Regulatory", CurrentUser) Then
> >> Me.Add_Review_Employee_Information.Visible = True
> >> Me.cmdViewTraining.Visible = True
> >> Me.cmdReviseSops.Visible = True
> >> Me.cmdAddBpr.Visible = True
> >> Me.cmdRunReports.Visible = True
> >> Me.cmdAddLotNumber.Visible = True
> >> Me.cmdExit.Visible = True
> >> Else
> >> Me.cmdAddLotNumber.Visible = False
> >> End If
> >>
> >> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
> >> Me.cmdRunReports.Visible = True
> >> Me.cmdAddLotNumber.Visible = True
> >> Me.cmdExit = True
> >> Else
> >> Me.Add_Review_Employee_Information.Visible = False
> >> Me.cmdAddBpr.Visible = False
> >> Me.cmdReviseSops.Visible = False
> >> Me.cmdViewTraining.Visible = False
> >> End If
> >>
> >>
> >>
> >>
> >> End Sub
>
>
>
Re: If faq_IsUserInGroup Syntax for three groups.
Olu Solaru 20.07.2006 20:44:01
Does this mean I that I do not have to write some sort of procedure for the
two other groups ...Being somewhat repetitive.?

"Joan Wild" wrote:

[Quoted Text]
> I have never set a reference to ADO, since all my databases use Jet as the
> backend. If you don't need ADO then set the reference to DAO.
>
> As for your code, I assume that a user can be a member of only one group.
> Looking at your if statements, it appears that the Admins group and the
> Regulatory group can see all buttons, but the Manufacturing group can only
> see
> cmdRunReports
> cmdAddLotNumber
> cmdExit
> Post back if I've missed it...
>
> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
> Me.cmdRunReports.Visible = True
> Me.cmdAddLotNumber.Visible = True
> Me.cmdExit = True
> Me.Add_Review_Employee_Information.Visible = False
> Me.cmdAddBpr.Visible = False
> Me.cmdReviseSops.Visible = False
> Me.cmdViewTraining.Visible = False
> Else
> Me.Add_Review_Employee_Information.Visible = True
> Me.cmdViewTraining.Visible = True
> Me.cmdReviseSops.Visible = True
> Me.cmdAddBpr.Visible = True
> Me.cmdRunReports.Visible = True
> Me.cmdAddLotNumber.Visible = True
> Me.cmdExit.Visible = True
> End If
>
> This would mean anyone in the Manufacturing group will see only three
> buttons, if the current user isn't in the Manufacturing group, they'll see
> them all. Is that what you want?
>
> --
> Joan Wild
> Microsoft Access MVP
>
> Olu Solaru wrote:
> > Another question - Can I make a reference to DAO objects in Access
> > 2003/WinXp, as oppose to ADO?
> >
> > "Olu Solaru" wrote:
> >
> >> I writing my code that will enable/disable controls based on the
> >> user groups. What I am finding is that when I set my code for one
> >> particular groups it affects the other groups. So my question is,
> >> will I have to use the If faq_IsUserInGroup statement for all of my
> >> groups?
> >>
> >> For example,
> >>
> >> I have 7 controls on my form.
> >>
> >> I have the Admin, Manufacturing, and Regulatory group.
> >>
> >> I have set my coding as follows:
> >> If faq_IsUserInGroup("Admins", CurrentUser) Then
> >> Me.Add_Review_Employee_Information.Visible .... (For the admin
> >> group, my intention is to make all the controls visibile - Am I
> >> going in the right direction?)
> >>
> >> If faq_IsUserInGroup("Regulatory", CurrentUser) Then
> >> Me.Add_Review_Employee_Information.Visible = True
> >> Me.cmdViewTraining.Visible = True
> >> Me.cmdReviseSops.Visible = True
> >> Me.cmdAddBpr.Visible = True
> >> Me.cmdRunReports.Visible = True
> >> Me.cmdAddLotNumber.Visible = True
> >> Me.cmdExit.Visible = True
> >> Else
> >> Me.cmdAddLotNumber.Visible = False
> >> End If
> >>
> >> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
> >> Me.cmdRunReports.Visible = True
> >> Me.cmdAddLotNumber.Visible = True
> >> Me.cmdExit = True
> >> Else
> >> Me.Add_Review_Employee_Information.Visible = False
> >> Me.cmdAddBpr.Visible = False
> >> Me.cmdReviseSops.Visible = False
> >> Me.cmdViewTraining.Visible = False
> >> End If
> >>
> >>
> >>
> >>
> >> End Sub
>
>
>
Re: If faq_IsUserInGroup Syntax for three groups.
"Joan Wild" <jwild[ at ]nospamtyenet.com> 20.07.2006 21:01:20
That's right, they'll be covered off by the Else portion; since both the
Admins and Regulatory see all the buttons.

--
Joan Wild
Microsoft Access MVP

Olu Solaru wrote:
[Quoted Text]
> Does this mean I that I do not have to write some sort of procedure
> for the two other groups ...Being somewhat repetitive.?
>
> "Joan Wild" wrote:
>
>> I have never set a reference to ADO, since all my databases use Jet
>> as the backend. If you don't need ADO then set the reference to DAO.
>>
>> As for your code, I assume that a user can be a member of only one
>> group. Looking at your if statements, it appears that the Admins
>> group and the Regulatory group can see all buttons, but the
>> Manufacturing group can only see
>> cmdRunReports
>> cmdAddLotNumber
>> cmdExit
>> Post back if I've missed it...
>>
>> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
>> Me.cmdRunReports.Visible = True
>> Me.cmdAddLotNumber.Visible = True
>> Me.cmdExit = True
>> Me.Add_Review_Employee_Information.Visible = False
>> Me.cmdAddBpr.Visible = False
>> Me.cmdReviseSops.Visible = False
>> Me.cmdViewTraining.Visible = False
>> Else
>> Me.Add_Review_Employee_Information.Visible = True
>> Me.cmdViewTraining.Visible = True
>> Me.cmdReviseSops.Visible = True
>> Me.cmdAddBpr.Visible = True
>> Me.cmdRunReports.Visible = True
>> Me.cmdAddLotNumber.Visible = True
>> Me.cmdExit.Visible = True
>> End If
>>
>> This would mean anyone in the Manufacturing group will see only three
>> buttons, if the current user isn't in the Manufacturing group,
>> they'll see them all. Is that what you want?
>>
>> --
>> Joan Wild
>> Microsoft Access MVP
>>
>> Olu Solaru wrote:
>>> Another question - Can I make a reference to DAO objects in Access
>>> 2003/WinXp, as oppose to ADO?
>>>
>>> "Olu Solaru" wrote:
>>>
>>>> I writing my code that will enable/disable controls based on the
>>>> user groups. What I am finding is that when I set my code for one
>>>> particular groups it affects the other groups. So my question is,
>>>> will I have to use the If faq_IsUserInGroup statement for all of my
>>>> groups?
>>>>
>>>> For example,
>>>>
>>>> I have 7 controls on my form.
>>>>
>>>> I have the Admin, Manufacturing, and Regulatory group.
>>>>
>>>> I have set my coding as follows:
>>>> If faq_IsUserInGroup("Admins", CurrentUser) Then
>>>> Me.Add_Review_Employee_Information.Visible .... (For the admin
>>>> group, my intention is to make all the controls visibile - Am I
>>>> going in the right direction?)
>>>>
>>>> If faq_IsUserInGroup("Regulatory", CurrentUser) Then
>>>> Me.Add_Review_Employee_Information.Visible = True
>>>> Me.cmdViewTraining.Visible = True
>>>> Me.cmdReviseSops.Visible = True
>>>> Me.cmdAddBpr.Visible = True
>>>> Me.cmdRunReports.Visible = True
>>>> Me.cmdAddLotNumber.Visible = True
>>>> Me.cmdExit.Visible = True
>>>> Else
>>>> Me.cmdAddLotNumber.Visible = False
>>>> End If
>>>>
>>>> If faq_IsUserInGroup("Manufacturing", CurrentUser) Then
>>>> Me.cmdRunReports.Visible = True
>>>> Me.cmdAddLotNumber.Visible = True
>>>> Me.cmdExit = True
>>>> Else
>>>> Me.Add_Review_Employee_Information.Visible = False
>>>> Me.cmdAddBpr.Visible = False
>>>> Me.cmdReviseSops.Visible = False
>>>> Me.cmdViewTraining.Visible = False
>>>> End If
>>>>
>>>>
>>>>
>>>>
>>>> End Sub


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net