Validate Password field against a value in a table

txczshooter

New member
Local time
Today, 05:52
Joined
Aug 8, 2015
Messages
3
Hello! Every year or so I get tasked with creating an access project. I get pretty familiar with some basic tables, queries, and forms, and then I lose everything I learned by the time I need to use it again.

Access 2007

I'm creating a database form that has a combo box drop down pulling EmployeeName and a free text field to enter a password. I need the password entry validated against the password stored in a column on the same row as the Employee Name selected from the combo box when a button is clicked. . IF, that value is validated, I need the button click to also record a "time in" or "clock in" entry in a different table. I thought this would be pretty easy, but I can't even remember how to validate the password.

HELP! :) Thanks for any guidance.
 
Last edited:
If Nz(dcount("*", "yourPasswordTableHere, "[yourUserFieldNameHere] = '" & Me.yourComboboxNameHere.Column(1) & "' And [yourPasswordFieldNameHere] = '" & Me.TextBoxControlNameHere & "'"), 0) = 0
'user name or password not in table

Else
'user name and password exist in table

End If
 
If Nz(dcount("*", "yourPasswordTableHere, "[yourUserFieldNameHere] = '" & Me.yourComboboxNameHere.Column(1) & "' And [yourPasswordFieldNameHere] = '" & Me.TextBoxControlNameHere & "'"), 0) = 0
'user name or password not in table

Else
'user name and password exist in table

End If

Thanks. While this looks familiar, what am I doing with this data?
 
Something like...

Code:
    If Me.txtPassword = DLookup("apPassword", "tblAssociateProfile", "apAssociateID =" & Me.cboAssociateID) Then
        DoCmd.Close acForm, "YourLogOnForm"
        DoCmd.OpenForm "YourMainMenu"
    Else
        MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
        Me.txtPassword = Null
        Me.cboAssociateID.SetFocus
        Me.txtPassword.SetFocus
    End If
...in the After_Update event of the Password control. Make sure to change the Table and Field names to match the ones in your database. You also need to add an APPEND query for your time to be sent to another table.
 

Users who are viewing this thread

Back
Top Bottom