Need to Be able to change password for this code

  • Thread starter Thread starter Chip
  • Start date Start date
C

Chip

I have written the following code to have a code password protected but i
need to allow the user to change the password if they need to. I have not
been able to get code to allow this. The current password for this code is
'9ii9'- Can someone help???
______
Private Sub Form_Open(Cancel As Integer)
Dim strResponse As String

strResponse = InputBox("Enter the password")

If strResponse = "" Then
Cancel = True
ElseIf strResponse <> "9ii9" Then
Cancel = True
MsgBox "Password incorrect. Entry denied."
End If

End Sub
______
 
(1) Create a database table with one row & one field to store the valid
password.

(2) Change your code to read the valid password from that table. (See the
DLookup() function.)

(3) When your code has determined that the user has entered a valid
password, ask him to enter a new password, or blanks. (See the InputBox()
function.)

(4) If the value he enters is not blank, save it into the table, replacing
the previous password value. (See the SQL UPDATE statement.)

This is a very rough & ready way of doing password management! But it would
probably be a useful exercise for you to compete.

HTH,
TC
 
Back
Top