D
Dennis
Access 2003
I would like to run the function below via a Sub routine like:
********************************
Sub ReplacePassword()
Call myFunction() ' This function generates myString (as A String) which
' represents my OldPassword
Call faqChangePassword(CurrentUser(), myString , Me!NewPassword)
End Sub
Function faqChangePassword(ByVal strUser As String, ByVal strPwd As String,
_ ByVal strOldPwd As String) As Integer
Dim ws As Workspace
Dim usr As User
On Error GoTo err_ChangePassword
Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(strUser)
usr.NewPassword strOldPwd, strPwd
err_ChangePassword:
If Err.Number = 3033 Then
MsgBox "You do not have permission to modify passwords. Please contact
your system administrator."
End If
End Function
***************************************
The problem occurs with the Me! Key word. The error states that there has
been an "improper use of Me."
Which module should the ReplacePassword() sub routine be placed? (my guess
= general module)
Which module should the faqChangePassword() sub routine be placed? (not sure?)
Should I make faqChangePassword() a Public function?
I would appreciate some help to make the above work.
Dennis
I would like to run the function below via a Sub routine like:
********************************
Sub ReplacePassword()
Call myFunction() ' This function generates myString (as A String) which
' represents my OldPassword
Call faqChangePassword(CurrentUser(), myString , Me!NewPassword)
End Sub
Function faqChangePassword(ByVal strUser As String, ByVal strPwd As String,
_ ByVal strOldPwd As String) As Integer
Dim ws As Workspace
Dim usr As User
On Error GoTo err_ChangePassword
Set ws = DBEngine.Workspaces(0)
Set usr = ws.Users(strUser)
usr.NewPassword strOldPwd, strPwd
err_ChangePassword:
If Err.Number = 3033 Then
MsgBox "You do not have permission to modify passwords. Please contact
your system administrator."
End If
End Function
***************************************
The problem occurs with the Me! Key word. The error states that there has
been an "improper use of Me."
Which module should the ReplacePassword() sub routine be placed? (my guess
= general module)
Which module should the faqChangePassword() sub routine be placed? (not sure?)
Should I make faqChangePassword() a Public function?
I would appreciate some help to make the above work.
Dennis