Determining if a user has a non-blank password

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a successully setup user-level security database and up to now have
not required users to use a password. In other words as Admin, I did not set
a password initially. I'd like to change that now. If I use the newpassword
method, then how do I control it's execution? I'd like the code to work that
if the oldpassword is blank, then prompt the user to enter a passwrod and run
newpassword to create it password. Otherwise don't run the code since the
password is set.
If I don't do this check and just make the newpassword method part of my
initialization code then it will appear every time the user logs in.
I haven't been able to find a solution anywhere in this or other newsgroups.
I have a lot of users (40 or more) so manually going in and doing it is not
acceptable. I suppose I could run the newpassword method on all users in VBA
but that would set a common password, or I'd have to keep track of a random
password the code generates for each user then send it to that user, again a
lot of work.
Am I missing something?
 
You can try to open a new workspace, passing CurrentUser() as the username
and "" as the password.
If you don't get an error, then the "" password is correct, and they have a
blank password.

Dim ws as Workspace
Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(),"")
If Err=0 then
'they have a blank password
'open a form for them to change their password
Else
'they don't have a blank password
'do nothing
End If
 
Hi Joan,

I tried to use your code and it does not work. I placed the code on the
open event of my main switchboard form.

The VBA compiler does not like the line

Set ws = DBEngine.CreateWorkspace("tempws", CurrentUser(), "")

If the user has a password, you get error 3029. Not a valid account name or
password.

Should I include an OnError statement to trap the error? And if so, how?

Thank you for your time.
 
Back
Top