Adding New User to WorkGroups

C

Casey

Hi,

I have an event procedure below that I use for the
onclick action of a button from a form.

On the form I have four text boxes, being Name1,
PIDt, PWord, and GrpJn. These boxes accept information
for a new user account and the group the user will be
joined into.

The boxes accept entries as Name1 for Name, PIDt for
Password ID, PWord for Password, and GrpJn for Group the
user will be joined to (besides the users group).

I had complete success with the procedure except for
the line which says "usr.Groups.Append usr.([GrpJn])".
That is where I am trying to join the user to the Group
specified by the GrpJn text box on my form. I would
appreciate any advice on how to have that part of my
procedure work.


Private Sub Command174_Click()
Dim ws As Workspace, usr As User
Dim grp As Group
Set ws = DBEngine(0)
Set usr = ws.CreateUser([Name1], [PIDt], [PWord])
ws.Users.Append usr
usr.Groups.Append usr.CreateGroup("Users")
usr.Groups.Append usr.Groups([GrpJn])
Exit_Command174_Click:
Exit Sub

Err_Command174_Click:
MsgBox Err.Description
Resume Exit_Command174_Click

End Sub


Thanks for any help.

Casey
 
Top