"MLH" <CR**@NorthState.net> wrote in message
news:b6********************************@4ax.com...
A97: If I create a new user with CreateUser Method, is she
automatically a member of Users group? Or, do I have to
append her to that group?
After you create and append the new user to the users collection you can do
MsgBox usr.Groups.Count
Which will tell you that the new user is not a member of any groups. This
contrasts to when you create a new user with the workgroup administrator -
here they are automatically appende to the Users group. In DAO you have to
explicitly do this - and the syntax might not be obvious - look at how you
need two lots of CreateUser:
Private Sub AddUser()
On Error GoTo Err_Handler
Dim wks As DAO.Workspace
Dim usr As DAO.User
Dim grp As DAO.Group
Set wks = DBEngine.Workspaces(0)
Set usr = wks.CreateUser("MyUser", "MyPID", "MyPassword")
wks.Users.Append usr
wks.Users.Refresh
Set grp = wks.Groups("Users")
Set usr = grp.CreateUser("MyUser")
grp.Users.Append usr
grp.Users.Refresh
Exit_Handler:
On Error Resume Next
Set usr = Nothing
Set grp = Nothing
Set wks = Nothing
Exit Sub
Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler
End Sub