users switch groups in code

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

Here is what I have written before about this subject. This is a google
message-ID. Go to groups.google.com, click advanced groups search, & enter
this into the Message ID box (including the <>s):

<[email protected]>

PS. I hope your wksp variable is not pointing to the default workspace! (If
it is, you shouldn;t be closing it. Just set it to nothing.)

HTH,
TC
 
I want (certain) users to be able to switch from one group to another. The
code looks like this:
Set usr = wksp.Users(CurrentUser)
Set grpTemp = usr.CreateGroup("One")
usr.Groups.Append grpTemp
usr.Groups.Delete "Two"
usr.Groups.Refresh
wksp.Close
It works, but doesn't take effect until the user quits and restarts. After
running this, the user appears in the correct group using
Tools>Security>User and Group Accounts. The user is still in the old group
if I test with a function:
Set wrk = DBEngine.Workspaces(0)
varUser = CurrentUser()
isUserMember = (wrk.Groups(strGroup).Users(varUser).Name = varUser)

How do I refresh this without restarting?
 
Thanks.
It is the default wksp and I normally wouldn't close it, but I thought it
might help with the refresh. I learned not to close it when some of the
code was used during a transaction!
btw, parts of the code are copied from Access 2002 Enterprise Developer's
Handbook by Litwin, Getz and Gunderloy.
 
Back
Top