Refer to user group in VBA

JohnL7

Registered User.
Local time
Yesterday, 21:03
Joined
Nov 17, 2005
Messages
34
Hi All,

I've searched the forum for ages and found lots of threads on security but I'm not quite finding what I think I need.

I have a database with microsoft access user level security in place, this works fine. I now need to add group level security so that only users in a particular group can activate a command button which would open another form. If a user is not a member of that group a message box would be displayed.

I've been trying to achieve this in vba code using If..then...else statements. I can get it to work for individaul users using the Currentuser() expression but I can't seem to be able to refer to a group.

Could someone give an example of how to use code which names a user group?

Many Thanks

John
 
Users and Groups are both collections.

You can see a user as a collection such as object.Users

In each .Users(n) there is a groups collection.

You can step through the .Users(n).Groups collection to see what is in it. IN THEORY it should contain all of the groups of which the user is a member and no other groups.
 
Hi Doc Man,

Many thanks for getting back. On re-reading my thread I realised I'm not being terribly precise or clear.

I'm not so concerned about membership of groups, what I would like to do is is allow only one user group ("North therapists") to be able to use a command button which allows access to their confidential information. There are other command buttons on the same form which I would also like to set up in a similiar way e.g. on clicking a different command button the user group ("South Therapists") would access their confidential information.

I thought I might be able to do this in vba code but it seems to be proving a bit tricky.

John
 

Users who are viewing this thread

Back
Top Bottom