I am trying to create a command button to allow the CurrentUser to change their password from the code I found on web. I am not sure if it will work because I have not set up the workgroup yet. How can you set up the user object. Also is there a way to write this code so it will allow the user to change their password even if it is not blank like my code currently assumes. Any help would be appreciated.
Thank You,
rjoshi
'current code
Sub ChangePasswordX()
'CurrentpW and NewPW are variables representing those values.
'As you can see you can create an User object by using:
'objUser = DBEngine.Workspaces(0).Users(CurrentUser())
Dim CurrentPW As String
Dim NewPW As String
CurrentPW = ""
DBEngine.Workspaces(0).Users(CurrentUser()).NewPassword CurrentPW, NewPW
End Sub
------------------------------------------------------------
I think this code might work except I am not sure how to get the current password (for CurrentPW).
'new code
Sub ChangePasswordX2()
Dim CurrentPW As String
Dim NewPW As String
If CheckBlankPassword = True Then
DBEngine.Workspaces(0).Users(CurrentUser()).NewPassword CurrentPW, NewPW
Else
DBEngine.Workspaces(0).Users(CurrentUser()).NewPassword CurrentPW, NewPW
End If
End Sub
Function CheckBlankPassword() As Boolean
On Error GoTo fct_err
DBEngine.Workspaces(0).Users(CurrentUser).NewPassword "", ""
fct_err:
If Err = 3033 Then
CheckBlankPassword = False
Resume fct_exit
Else
CheckBlankPassword = True
Resume fct_exit
End If
fct_exit:
End Function
Thank You,
rjoshi
'current code
Sub ChangePasswordX()
'CurrentpW and NewPW are variables representing those values.
'As you can see you can create an User object by using:
'objUser = DBEngine.Workspaces(0).Users(CurrentUser())
Dim CurrentPW As String
Dim NewPW As String
CurrentPW = ""
DBEngine.Workspaces(0).Users(CurrentUser()).NewPassword CurrentPW, NewPW
End Sub
------------------------------------------------------------
I think this code might work except I am not sure how to get the current password (for CurrentPW).
'new code
Sub ChangePasswordX2()
Dim CurrentPW As String
Dim NewPW As String
If CheckBlankPassword = True Then
DBEngine.Workspaces(0).Users(CurrentUser()).NewPassword CurrentPW, NewPW
Else
DBEngine.Workspaces(0).Users(CurrentUser()).NewPassword CurrentPW, NewPW
End If
End Sub
Function CheckBlankPassword() As Boolean
On Error GoTo fct_err
DBEngine.Workspaces(0).Users(CurrentUser).NewPassword "", ""
fct_err:
If Err = 3033 Then
CheckBlankPassword = False
Resume fct_exit
Else
CheckBlankPassword = True
Resume fct_exit
End If
fct_exit:
End Function