J
Jim Bunton
* I cannot append a new user to a group!
* Windows 2000 [Ia m Administrator]
* Access 97 I am logged in as a member of Admins
I own every object
I have full permission on every object
--------------------------------------------
I have now resorted to almost the identical code in the Access 97 help files
Users Object (DAO)
- code example 1 [with additions]
'CreateUser Method and Password and PID Properties Example'
[began without the additions]
-------------------------------------------
=== Code start =====
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim WkSpace As Workspace, grpNew As Group, usrTemp As User
Dim usrMine As User
Set WkSpace = DBEngine.Workspaces(0)
With WkSpace
' Create and append new Group.
Set grpNew = .CreateGroup("NewGroup", "AAA123456789")
'THE NEXT succeeds
.Groups.Append grpNew
' Make the user "NewUser" a member of the
'group "NewGroup" by creating and adding the
'appropriate User object to the group's Users
'collection.
Set usrTemp = .Groups("NewGroup").CreateUser("NewUser")
Set usrMine = .CreateUser("MyNewUser", "123456", "Pwd")
'usrTemp.PID = "AAA123456789"
'usrTemp.Password = "NewPassword"
'THE NEXT fails
' 3030 'NewUser' Isn't valid account
.Groups("NewGroup").Users.Append usrTemp
'THE NEXT succeeds
.Users.Append usrMine
'THE NEXT Fails
'3219 - Invalid Operation
.Groups("NewGroup").Users.Append usrMine
End With
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err & " - " & Err.Description
Resume Next
End Sub
==== Code End ====
--
Jim Bunton
(e-mail address removed)
13 Westbourne Road
Trowbridge
Wilts. BA14 0AJ
Tel: 01225 765 541
Mobile: 07919 283 968
* Windows 2000 [Ia m Administrator]
* Access 97 I am logged in as a member of Admins
I own every object
I have full permission on every object
--------------------------------------------
I have now resorted to almost the identical code in the Access 97 help files
Users Object (DAO)
- code example 1 [with additions]
'CreateUser Method and Password and PID Properties Example'
[began without the additions]
-------------------------------------------
=== Code start =====
Private Sub Command2_Click()
On Error GoTo Err_Command2_Click
Dim WkSpace As Workspace, grpNew As Group, usrTemp As User
Dim usrMine As User
Set WkSpace = DBEngine.Workspaces(0)
With WkSpace
' Create and append new Group.
Set grpNew = .CreateGroup("NewGroup", "AAA123456789")
'THE NEXT succeeds
.Groups.Append grpNew
' Make the user "NewUser" a member of the
'group "NewGroup" by creating and adding the
'appropriate User object to the group's Users
'collection.
Set usrTemp = .Groups("NewGroup").CreateUser("NewUser")
Set usrMine = .CreateUser("MyNewUser", "123456", "Pwd")
'usrTemp.PID = "AAA123456789"
'usrTemp.Password = "NewPassword"
'THE NEXT fails
' 3030 'NewUser' Isn't valid account
.Groups("NewGroup").Users.Append usrTemp
'THE NEXT succeeds
.Users.Append usrMine
'THE NEXT Fails
'3219 - Invalid Operation
.Groups("NewGroup").Users.Append usrMine
End With
Exit_Command2_Click:
Exit Sub
Err_Command2_Click:
MsgBox Err & " - " & Err.Description
Resume Next
End Sub
==== Code End ====
--
Jim Bunton
(e-mail address removed)
13 Westbourne Road
Trowbridge
Wilts. BA14 0AJ
Tel: 01225 765 541
Mobile: 07919 283 968