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
(e-mail address removed)
"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" <
[email protected]>
| Newsgroups: microsoft.public.access.security
| References: <
[email protected]>
<
[email protected]>
| Subject: Thanks Re: Append usrNew
| Lines: 157
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| Message-ID: <
[email protected]>
| Date: Tue, 05 Oct 2004 11:52:39 GMT
| 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
|
| 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,
| >
| > Per Microsoft help topic:
| >
| > ' Make the user "admin" a member of the
| > ' group NewGroup by creating and adding the
| > ' appropriate Group object to the user's Groups
| > ' collection.
| > Set grpTemp = .Users("admin").CreateGroup("NewGroup")
| > .Users("admin").Groups.Append grpTemp
| >
| > Your code
| > Grp.Users.Append usrNew
| >
| > Should be something like
| > .Users(Me.UserLogOn).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
| > (e-mail address removed)
| > "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" <
[email protected]>
| > | Newsgroups: microsoft.public.access.security
| > | Subject: Append usrNew
| > | Lines: 43
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
| > | Message-ID: <
[email protected]>
| > | Date: Fri, 01 Oct 2004 20:17:31 GMT
| > | NNTP-Posting-Host: 82.33.64.49
| > | X-Trace: fe2.news.blueyonder.co.uk 1096661851 82.33.64.49 (Fri, 01 Oct
| > 2004 21:17:31 BST)
| > | 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
| > | X-Tomcat-NG: microsoft.public.access.security
| > |
| > | Problem appending a new user to a Group:
| > | <<<< code >>>>>
| > | Set WkSpace = DBEngine.Workspaces(0)
| > | With WkSpace
| > | 'Create and append new User.
| > | Set usrNew = .CreateUser(Me.UserLogOn)
| > | usrNew.PID = Me.NewUserPid
| > | usrNew.Password = Me.NewUserPw
| > | .Users.Append usrNew
| > | 'append the user to the selected group
| > | Set Grp = .Groups(Me.SelGrp)
| > | MsgBox Grp.Name & " - " & usrNew.Name
| > | 'Msg box works fine
| > | ' WHY DOES THE NEXT LINE
| > | 'GIVE THE ERROR
| > | '3219 Invalid operation [please!]
| > | Grp.Users.Append usrNew
| > | 'FROM HELP:-Remarks:- You can
| > | 'append an existing User object to the
| > | 'Users collection of a Group object
| > | End With
| > | <<<<< END code >>>>>>>>>>
| > |
| > |
| > |
| > | --
| > | Jim Bunton
| > | (e-mail address removed)
| > | 13 Westbourne Road
| > | Trowbridge
| > | Wilts. BA14 0AJ
| > | Tel: 01225 765 541
| > | Mobile: 07919 283 968
| > |
| > |
| > |
| > |
| > | ---
| > | Outgoing mail is certified Virus Free.
| > | Checked by AVG anti-virus system (
http://www.grisoft.com).
| > | Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
| > |
| > |
| > |
| >
|
|
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (
http://www.grisoft.com).
| Version: 6.0.771 / Virus Database: 518 - Release Date: 28/09/2004
|
|
|