Home > Blockchain >  refer to a cell in an access table
refer to a cell in an access table

Time:06-23

I have a login form that requiers verification of username and password I hashed the password in the access table (sha1) I used the dlookup function to find the user but i didnt know how to compare the password entered only with the found username's password

If (IsNull(DLookup("UserName", "UserID", "UserName='" & Me.Userbox.Value & "'")))

i did this but when the username is found i dont know how to refer to its password saved as a hash means that i want to know how to refer to a cell in an acess table. thank you

CodePudding user response:

It's best to open a recordset containing the username and password for the given user. If the username doesn't exist, the recordset will be empty.

Dim r As DAO.Recordset
Set r = CurrentDb().OpenRecordset("SELECT UserName, Password FROM UserID WHERE UserName='" & Userbox.Value & "'", dbOpenSnapShot)

If r.EOF Then
    'Username does not exist
    Exit Sub
End If

'Reaching this point means the username exists. 
'Hash the given password and compare it with the one stored in the table.
'The password returned from the recordset can be obtained using r![Password]
  • Related