Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change password

Status
Not open for further replies.

rjoshi2

Programmer
Sep 10, 2002
110
US
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

 
You have to create and join a new workgroup, then use the Access Security wizard on your database
 
Get and read and re-read and re-re-read the security faq. It's got code to change passwords. There's a copy on my website. As bt hints, there's no real point in trying any of this until you secure your database.

Jeremy =============
Jeremy Wallace
AlphaBet City Dataworks

Take a look at the Developers' section of the site for some helpful fundamentals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top