Adding Users with code

J

James Stephens

I found this code on google to add users, I set it up to receive the three
variables from my form. When I run it I get an error: Type Mismatch

Does anybody have an idea as to what I am doing wrong? It seems fairly
straightforward, but it doesn't work, and I can't figure out why. I have
searched all through the group and I cant find anybody having this problem.

Dim ws As Workspace, usr As User
txtLoginName = Me.NewUser
txtPassword = Me.NewPassword
txtPID = Me.NewPID

' Create and append new User
Set ws = DBEngine.Workspaces(0)
Set usr = ws.CreateUser("NewUserName", "000134", "NU123")
ws.Users.Append usr

' Add user to the Users group
With ws.Groups("Full Data Users")
Set usr = .CreateUser(txtLoginName)
.Users.Append usr
End With


Thanks,
James Stephens
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top