Adding Passwords Via Form Information

C

Casey

Hi,

I have an application that I recently built that has
security levels and user accounts.

I want to have adding users a simple thing for the
person charge for my system.

Lets say I have a form with Name1, PIDt, and PWord
boxes, and the form name is Form1. Name1 being a name of
a user, PIDt being a Password ID, and PWord being a
password for the user.

If I place a button on that form, and have it use the
following code for its onclick function, do you feel it
would be effective.

Also could I place that code as the runcode action of
a macro and have it operate?


Sub ChangePasswords ()

Dim ws As Workspace, usr As User

Set Usr = ws.CreateUser([forms].[form1].[Name1], [forms].
[form1].[PIDt], [forms].[form1].[PWord])

ws.users.Append usr

End Sub


I certainly appreciate any helpful opinions.

Thanks in advance.

Casey






availabilityI would like to have a button set up on a form
for
the user security manager of the system. I want the
onclick action of this button to take the user directly to
a screen where the user can create a new user account,
assign the user to an already established group, okay it,
close, and be returned to the main screen of my program.

If you have some really true advice I would
appreciate it.

Thanks in advance.

Casey
..
 
G

Graham Mandeno

Hi Casey

Did you not see Albert Kallal's answer to your post yesterday? He was even
offering to send you sample code.

Your code will mostly work OK. You need to initialise your ws variable:
Set ws = DBEngine(0)

Also, if your code is attached to a command button, it should be in that
button's Click event in the form's class module. Then you don't need to
reference the form object:
Set Usr = ws.CreateUser([Name1], [PIDt], [PWord])

Macros? RunCode? Bleeeech! Just run the code directly from an event
procedure.

Finally, *every* user you add must also be added to the Users group, so
after the ws.users.Append, you will need:
usr.Groups.Append usr.CreateGroup("Users")

Did you get that ChangePassword form I sent you yesterday?

--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand

Return mail address is invalid in a vain attempt to reduce spam.
Feedback is welcome at: (e-mail address removed)
Please post new questions or followups to newsgroup.
 

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