> "Marco" <Marco[ at ]discussions.microsoft.com> wrote in message
> news:465AA353-F43B-4CF0-ACF7-C55AF3241B37[ at ]microsoft.com...
> > Hi. i would like to give some permissions in my form directly from VBA
> > code.
> >
> > How can I identify to which group the current user belong?
>
> A user can be in multiple groups, so you need to ask the question:
> Is the user in the Admin (or whatever) group?
> rather than
> Which group is the user in?
>
> Function IsUserInGroup(strUser As String, strGroup As String) As Boolean
> Dim varDummy As Variant
> On Error Resume Next
> varDummy = DBEngine(0).Users(strUser).Groups(strGroup).Name
> IsUserInGroup = (Err.Number = 0)
> End Function
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users -
http://allenbrowne.com/tips.html> Reply to group, rather than allenbrowne at mvps dot org.
>
>