password please

quantz

New member
Local time
Today, 11:19
Joined
Jan 1, 2003
Messages
8
iiii...
can anybody help me to solve this problem...
i want to make a function on my form that allow user to change their password...
this password and user name is keep on the table
i want this function run like this...
first it will read the old password and compare on the database...
if correct then it will order user to input their new password twice..
the second is for comfirmation...
the password on the database will replace by this new password...
can anyone give me the code and the item i should provide on my form...
i think i want to use 3 text box for input the password..
i hope anybody will help me to solve my problem...
tq:confused:
 
Hi there

I've created a quick example for you. Here's what you'll need to do to try it.

1. Create a table called tblUsers with text fields Username and Password.

2. Create a form called frmUsers with text boxes for username (txtUsername), password (txtCurrentPassword), new password (txtNewPassword) and password check (txtConfirmPassword).

Put the following code behind the form:

Private Sub txtCurrentPassword_AfterUpdate()

Dim SavedPassword As String

SavedPassword = DLookup("[Password]", "tblUsers", "[Username] = '" & Me.txtUsername & "'")

If SavedPassword <> Me.txtCurrentPassword Then
MsgBox "Incorrect password entered. Please try again!"
Me.txtCurrentPassword = Null
End If

End Sub

Private Sub txtNewPassword_AfterUpdate()

CheckNewPassword

End Sub

Private Sub txtConfirmPassword_AfterUpdate()

CheckNewPassword

End Sub

Private Sub CheckNewPassword()

If Not IsNull(Me.txtNewPassword) And Not IsNull(Me.txtConfirmPassword) Then
If Me.txtNewPassword = Me.txtConfirmPassword Then
'run query to update password in table
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryUsers"
DoCmd.SetWarnings True
MsgBox "Password successfully updated!"
Else
MsgBox "You entered different passwords. Please try again!"
Me.txtNewPassword = Null
Me.txtConfirmPassword = Null
Me.txtNewPassword.SetFocus
End If
End If
End Sub

3. Create a query (qryUsers) and put the following SQL code into it:

UPDATE tblUsers SET tblUsers.[Password] = [forms]![frmUsers]![txtNewPassword]
WHERE (((tblUsers.Username)=[forms]![frmUsers]![txtUsername]));

This should give you the bare bones of what you are trying to do.

shay :cool:
 
thanks

iii..
thank for your reply...
i will try it...
and if any problem i will reply back..
bai
 
When doing his I also use a small procedure to encode the password too on the off chance that anyone (i.e. the master idiot) gets into the database.

I usually just play with the length of the password string:

PHP:
For intCounter = 1 To Len(txtPassword)
If intCounter Mod 2 = 0 Then
strCode = strCode + Chr(Asc(Mid(UCase(txtPassword), intCounter, 1)) + 1)
Else
strCode = strCode + Chr(Asc(Mid(UCase(txtPassword), intCounter, 1)) + 2)
End If
Next intCounter
 
Last edited:

Users who are viewing this thread

Back
Top Bottom