PDA

View Full Version : Password change forms


CoverSix
Jan 31, 2008, 11:58 AM
I secured a form in my Access database with the following code:

Private Sub Command48_Click()
'Attached to On Click event of Command48

Dim strPasswd

strPasswd = InputBox("Enter Password", "Restricted Form")

'Check to see if there is any entry made to input box, or if
'cancel button is pressed. If no entry made then exit sub.

If strPasswd = "" Or strPasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "Required Data"
Exit Sub
End If

'If correct password is entered open Secure Personnel form
'If incorrect password entered give message and exit sub

If strPasswd = "******" Then
DoCmd.OpenForm "Secure_Form", acNormal

Else
MsgBox "Access Denied", vbOKOnly, "Important Information"
Exit Sub
End If
End Sub

My boss loved this, then asked me how he could change the password without having to crack open the code to do it. So now I need to modify the above code to include a functionality to change the password.

I'm not a programmer, and the little VB I know I learned in school over a year ago. Can anyone provide a solution? Thanks!

kabia
Feb 22, 2008, 04:20 PM
You could read / write to an Ini file and compare what was in the Ini file to what was typed in...
Or just create a file that it opens and reads to compare...
Not recommended if you were to package and deploy...
But in a small environment could be OK... All your boss would need to do is open the file and write the new password in...
With an ini file you could encrypt it... so then you would need to decrypt it within your program, so have an admin section in your program to setup passwords etc...
Hope this gave you some ideas anyway..