Sett a New Password

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have managed to password my mdb using the tecnique on the MS page here
http://support.microsoft.com/kb/209871
I have set a default password but want the user to be able to enter a new
password on a form and have it encoded and saved as the current password.
My VB experience is limited. I have tried using a text box with a dara
source of
?KeyCode("The Original TextBox where they enter the new pw") but this
returns an error.

I have tried using a macro to open the table and setvalue of the keycode
field to
?KeyCode("The Original TextBox where they enter the new pw") but this
returns an error also.

Please help. Thank you.
 
I have managed to password my mdb using the tecnique on the MS page here
http://support.microsoft.com/kb/209871
I have set a default password but want the user to be able to enter a new
password on a form and have it encoded and saved as the current password.
My VB experience is limited. I have tried using a text box with a dara
source of
?KeyCode("The Original TextBox where they enter the new pw") but this
returns an error.

I have tried using a macro to open the table and setvalue of the keycode
field to
?KeyCode("The Original TextBox where they enter the new pw") but this
returns an error also.

Assuming that you have used the EXACT table structure as shown in the KB article, then you'd do something like the code
samples below. The code below would be put on any form where you want to update the password, and would usually be
called in the Click event of a button (in this example, I've named my button cmdNewPassWord):

Sub cmdNewPassWord_Click()
DoCmd.OpenForm "frmUpdatePass", , , , , , Me.Name
End Sub

This code opens another form (frmUpdatePass, which you've built, which contains a textbox (txtPassword) and a Command
button (cmdUpdatePass)) and passes the name of the "calling" form along with it via the OpenArgs argument. The code
below is on the Click event of the cmdUPdatePass button, on frmUpdatePass:

Sub cmdUpdatePass_Click()
If Len(Me.txtPassword)=0 Then
MsgBox "You must enter a password"
Exit Sub
End If

Currentdb.Execute "UPDATE tblPassword SET KeyCode='" & Me.txtPassword & "' WHERE ObjectName='" Me.OpenArgs & "'"
DoCmd.Close acForm, "frmUpdatePassword"
End Sub

This uses the OpenArgs argument of the DoCmd.OpenForm method to pass the name of the form to frmUpdatePassword ... from
there, frmUpdatePassword then verifies that the user has actually entered a password, then updates the table and closes
the form ... for more info on the OpenArgs argument, see online help.
Please help. Thank you.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
Back
Top