Greeting, Jeff.
Jeff said:
Greetings, I have an application I am ready to distribute. When I
set up User level secruity I assigned all user a password. What I'd
like to do is force the users to change thier passwords the first
time they log in. Any ideas how to get this done?
You should invoke some VBA code when the database is opened. To
achieve this, use a startup form or an AutoExec macro with a RunCode
action.
To Test, whether the user should change the password, you could use
a function like this (with DAO code):
Function MustChangPassword(DefPwd As String) As Boolean
On Error GoTo Err_MustChangPassword
With DBEngine.CreateWorkspace("TestWorkspace", CurrentUser, DefPwd)
MustChangPassword = True
.Close
End With
Exit_MustChangPassword:
Exit Function
Err_MustChangPassword:
MustChangPassword = False
Resume Exit_MustChangPassword
End Function
To let the user change the password, use a form with two textboxes
NewPwd and ConfirmPwd, Password as Input Mask. Check any neccessary
condition (to compare both entries, use the StrComp function) and
finally set the password using something like
With DBEngine.Workspaces(0).Users(CurrentUser)
.NewPassword DefPwd, NewPwd
End With