Link to home
Start Free TrialLog in
Avatar of running32
running32

asked on

Change a Users Domain Password from inside Access application

I have an access application and need the query the users domain password and allow them to change it.  I can get the user name using the advapi32.dll but I now need to have a form that allows them to enter in a new password and old and change the network password.

Thanks
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Are you familiar with the AD library available for Access?  It allows the query of AD for whatever you need, and has a method to change a user's password.
Avatar of running32
running32

ASKER

No I'm not familiar with the AD Library, I'll take a look.  Do you have any examples?

Thanks
I think I have it I use the adhSetPwd function.  correct!
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ouch that is very steep is there any easier way to do it? :-)
Most of it is cut-n-paste.  The main things you have to worry about are the CommandText (this one shows an LDAP query, though I understand there is a way to do it with SQL too), and making sure you have your search criteria correct.  Once the LDAP connection is set up and you have your objects bound, you can retrieve all the information into a normal ADO recordset and work from there.  It's the rest that is a pain in the buttocks.

On top of the curve, you should realize that the code I posted only pulls the user's logon, first and last name, email address, the user's account's flags, and the full distinguished name of the user object within AD (CN=Smith,CN=JOHN,OU=Users,DC=MyDomain,DC=COM).  This does even bind to the actual user object, much less allow for changing any information, which I haven't gotten up enough courage to do yet.  :)  I'd be happy to experiment along with you - the curve won't be nearly as steep for me - but it is likely to be a rather involved process.  That code represents about 5 hours of research, coding, and debugging.
I think I have to play around with this but it seems to be what i need.  Thanks