Thanks for the reply Eric.
My confusion arose from the syntax insisting one uses 'CreateGroup' to
append a group even when it already exixts.
Below nice clear eg in response to me reposting the problem as "append new
user to a group" because no one had at that time responded to this posting
Thanks again - Jim Bunton.
===== EG =====
Dim wrk As Workspace
Dim usrNew As User
Dim grp As Group
Set wrk = DBEngine.Workspaces(0)
'Create new group
Set grp = wrk.CreateGroup("MyGroup", "12345")
wrk.Groups.Append grp
'Create new user
Set usrNew = wrk.CreateUser("SomeUser", "98766", "SomePassword")
wrk.Users.Append usrNew
'Add user to Users and MyGroup groups
wrk.Groups.Refresh
wrk.Users.Refresh
usrNew.Groups.Append wrk.CreateGroup("Users")
usrNew.Groups.Append wrk.CreateGroup("MyGroup")
==== EG End =====
Hi Jim,
Try this:
=============================
Dim wrk As Workspace
Dim usrNew As User
Dim grp As Group
Set wrk = DBEngine.Workspaces(0)
With wrk
'Create new group
Set grp = .CreateGroup("MyGroup", "12345")
.Groups.Append grp
'Create new user
Set usrNew = .CreateUser("SomeUser", "98766", "SomePassword")
.Users.Append usrNew
'Append User to Users Group and MyGroup
Set grp = .Users("SomeUser").CreateGroup("MyGroup")
.Users("SomeUser").Groups.Append grp
Set grp = .Users("SomeUser").CreateGroup("Users")
.Users("SomeUser").Groups.Append grp
End With
============================
The confusing part are the below lines which appear like you are creating
the Groups again. You are not...
Set grp = .Users("SomeUser").CreateGroup("MyGroup")
.Users("SomeUser").Groups.Append grp
Set grp = .Users("SomeUser").CreateGroup("Users")
.Users("SomeUser").Groups.Append grp
I hope this helps! If you have additional questions on this topic, please
respond back to this posting.
Regards,
Eric Butts
Microsoft Access Support
ebutts@online.microsoft.com
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."
This posting is provided "AS IS" with no warranties, and confers no rights
--------------------
| From: "Jim Bunton" <jBunton@BlueYonder.co.uk>
| Newsgroups: microsoft.public.access.security
| References: <vXi7d.174118$hZ3.149226@fe2.news.blueyonder.co.uk>
<97uhv7nqEHA.3212@cpmsftngxa06.phx.gbl>
| Subject: Thanks Re: Append usrNew
| Lines: 157
[quoted text clipped - 6 lines]
| NNTP-Posting-Host: 82.33.64.49
| X-Trace: fe1.news.blueyonder.co.uk 1096977159 82.33.64.49 (Tue, 05 Oct
2004 12:52:39 BST)
| NNTP-Posting-Date: Tue, 05 Oct 2004 12:52:39 BST
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.s
ul.t-online.de!t-online.de!npeer.de.kpn-eurorings.net!border2.nntp.ams.gigan
ews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.n
et!blueyonder!pe1.news.blueyonder.co.uk!blueyonder!fe1.news.blueyonder.co.uk
.POSTED!53ab2750!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.security:13912
| X-Tomcat-NG: microsoft.public.access.security
[quoted text clipped - 85 lines]
| > | NNTP-Posting-Date: Fri, 01 Oct 2004 21:17:31 BST
| > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onlin
e.de!npeer.de.kpn-eurorings.net!border2.nntp.ams.giganews.com!nntp.giganews.
com!mephistopheles.news.clara.net!news.clara.net!pe1.news.blueyonder.co.uk!b
| > lueyonder!fe2.news.blueyonder.co.uk.POSTED!53ab2750!not-for-mail
| > | Xref: cpmsftngxa06.phx.gbl microsoft.public.access.security:13848
[quoted text clipped - 27 lines]
| Checked by AVG anti-virus system (http://www.grisoft.com).
| Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004