Clear user password in VB

  • Thread starter fmc via AccessMonster.com
  • Start date
F

fmc via AccessMonster.com

Does anyone know of a way to clear a user's password in VB if the user's old
password is unavailable? In other words, using VB code to do the same thing
as going to Tools/Security/User and Group Accounts... and clicking the Clear
Password button.

Thanks.
 
T

TC

You do mean VB - not VBA?

I've never done it from VB. Maybe try something like this:

(UNTESTED)

' open the workgroup information file.
with dbengine
.systemdb = "xxx"
.defaultuser = "yyy"
.defaultpassword = "zzz"
end with
' erase user Fred's password.
dbengine(0).users("Fred").new­password "", "new password"
set dbengine = nothing

In that code, replace xxx with the full path to the relevant workgroup
information file; yyy with the name of any member of the Admins group
of that workgroup file; and zzz with that user's password.

HTH,
TC
 
F

fmc via AccessMonster.com

Thanks for the reply. Actually, I did mean VBA but it doesn't matter. The
security menu in Access will work for this project.

Thanks again.
 
T

TC

If you meant VBA (not VB) then the code I gave you will not work.

To do it in VBA, you would use CreateWorkspace to create a workspace
for a member of the Admins group, then NewPassword to reset the
relevant user's password.

HTH,
TC
 

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