[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to reset a password

Posted on 2000-02-10
9
Medium Priority
?
336 Views
Last Modified: 2012-08-14
Hi there, i want to be able to reset a password without going to the security option of tools in the main menu.
I want to give the user (the dumb's one) a way to reset his password without having access to trhe source code or any of the object. So if there is some code i can use i would put that in an "Managing Form" so the user can go there enter is user and reset his password
0
Comment
Question by:tusken
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 5

Expert Comment

by:cekman
ID: 2508860
Try this function - this is from FMS SOURCEBOOK software:

Function ChangeUserPassword_TSB(strWorkspace As String, strUser As String, strOldPass As String, strNewPass As String) As Boolean
  ' Comments  : Changes the named user's password
  ' Parameters: strWorkspace - name of the workspace to use or "" (blank string) for Workspaces(0)
  '             strUser - name of the user
  '             strOldPass - user's current password
  '             strNewPass - user's new password
  ' Returns   : True if password was changed, False otherwise
  '
  Dim wrkTemp As Workspace
  Dim usrTemp As USER

  On Error GoTo PROC_ERR

  If strWorkspace = "" Then
    Set wrkTemp = DBEngine.Workspaces(0)
  Else
    Set wrkTemp = DBEngine.Workspaces(strWorkspace)
  End If

  Set usrTemp = wrkTemp.Users(strUser)
  usrTemp.NewPassword strOldPass, strNewPass

  ChangeUserPassword_TSB = True

PROC_EXIT:
  Exit Function

PROC_ERR:
  ChangeUserPassword_TSB = False
  Resume PROC_EXIT

End Function
0
 

Author Comment

by:tusken
ID: 2508899
Ok that is good but you need the old password... i really need to reset it because the user don't remember his password (i told you they where dumb!!)
so is that possible with that function, is it possible anyway and if yes how??

 
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2508922
Hating to type, (and read a lot of characters...), I'd like to see in place of some of that:

Public Function ChgPw(WkSp As String, strUser As String, strOld As String, strNew As String) As Boolean

  ' Comments  : Changes the named user's password
  ' Parameters: WkSp - name of the workspace to use or "" (blank string) for Workspaces(0)
  '             strUser - name of the user
  '             strOld - user's current password
  '             strNew - user's new password
  ' Returns   : True if password was changed, False otherwise

  On Error GoTo ChgPw_Err
 
  Dim wkTmp As Workspace
  Dim usrTmp As USER

  If strWkSp = "" Then
    Set wkTmp = DBEngine(0)
  Else
    Set wkTmp = DBEngine.Workspaces(WkSp)
  End If

  Set usrTmp = wkTmp.Users(strUser)
  usrTmp.NewPassword strOld, strNew

  ChgPw = True

ChgPw_Res:
  Exit Function

ChgPw_Err:
  ChgPw = False
  Resume ChgPw_Res

End Function

Brian

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
LVL 1

Expert Comment

by:tkuppinen
ID: 2508926
That attitude sort of reminds of that new character from SNL, the company computer expert .  Just remember if you're users get too "smart" then you're out of a job.
0
 
LVL 5

Accepted Solution

by:
cekman earned 400 total points
ID: 2508928
In the  Access 97 Developer's Handbook I found the following - basically using the same code:

"Only Admins members can change other users' passwords. For Admins member, old pwd is ignored.
When you use the NewPassword method, yoru are required to enter the correct old password if the account is the same as the value of CurrentUser; otherwise you don't have to enter the old password - the string is ignored. This behaviour is consistent with the Access UI, where you can clear someone else's password. The difference in DAO is that you can both clear and reset the password and set it to a new nonblank value in one step (as long as your an ADMINS member."

I didn't see anything about a user resetting their own password without first providing their old password.


CEKMAN
0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2508933
From Access Help:

Clear a security account password
To complete this procedure, you must be logged on as a member of the Admins group.

It doesn't look as if a user can change his password unless he already knows what it is...

(Maybe they are too stoopidd to use a compyootur...)

Brian
0
 

Author Comment

by:tusken
ID: 2508985
Exactly what i needed

Thx

0
 
LVL 9

Expert Comment

by:BrianWren
ID: 2509065
by 0:02 minutes!  Oh well...
0
 

Author Comment

by:tusken
ID: 2509097
i have another one coming... so try to be faster this time :-)
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Audit trails are very important in any system to hold people responsible for certain transactions and hold them to take ownership of their actions. This article is dedicated to all novice "Microsoft Access" developers.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question