Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Security / October 2004

Tip: Looking for answers? Try searching our database.

Append usrNew

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim Bunton - 01 Oct 2004 21:17 GMT
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 >>>>>>>>>>

Signature

Jim Bunton
jBunton@Blueyonder.co.uk
13 Westbourne Road
Trowbridge
Wilts. BA14 0AJ
Tel: 01225 765 541
Mobile: 07919 283 968

Eric Butts [MSFT] - 05 Oct 2004 02:59 GMT
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
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
[quoted text clipped - 8 lines]
| 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
[quoted text clipped - 21 lines]
|             End With
| <<<<< END code >>>>>>>>>>
Jim Bunton - 05 Oct 2004 12:52 GMT
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,
>
[quoted text clipped - 48 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 - 22 lines]
> |             End With
> | <<<<< END code >>>>>>>>>>
Eric Butts [MSFT] - 05 Oct 2004 20:16 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.