Display Message?

N

Neil Cash

I have a form with text fields on it and a command button. The command
button runs a macro, which runs a code:

Function ChangePassword() As Integer

Dim ws As Workspace
Dim usr As user
Dim OPwd As String
Dim NPwd As String
Dim MSG As Variant
Dim user As String

user = CurrentUser()
OPwd = Forms("Password").[OldPassword]
NPwd = Forms("Password").[NewPassword]

Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(user)

usr.NewPassword OPwd, NPwd
MSG = MsgBox("Password Changed", vbOK)
DoCmd.Close

End Function

The question is, what and where can I put something into the code that tests
whether or not the old password supplied is correct. Currently, if you
supply an incorrect password the debugger pops up and the macro comes to a
halt. Thanks in advance.

Neil Cash
 
Top