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!
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!