I'm very much not an Access user, but I had this in Excel, and hopefully VBA is VBA
Uses a class (in attachment) but this is sample usage.
I'm sure you can polish it up
Option Explicit
Sub Demo()
MsgBox CheckPW
End Sub
Function CheckPW() As Boolean
Dim oCrypto As clsSHA256
Dim pwStored As String, pwEntered As String
Dim iTries As Long
CheckPW = False
Set oCrypto = New clsSHA256
'probably stored in the database
pwStored = oCrypto.SHA256("password")
Debug.Print "Stored PW = " & pwStored
iTries = 3
Do
pwEntered = InputBox("Enter PW", "The Password Please", vbNullString)
Debug.Print "Raw entered PW = " & pwEntered
If Len(pwEntered) = 0 Then Exit Function
pwEntered = oCrypto.SHA256(pwEntered)
Debug.Print "Encrypted entered PW = " & pwEntered
If pwStored <> pwEntered Then
iTries = iTries - 1
If iTries > 0 Then MsgBox "Wrong password, Try #" & iTries & " left", vbCritical + vbOKOnly, "Enter Password"
End If
Loop Until (pwStored = pwEntered) Or (iTries = 0)
If iTries = 0 Then Exit Function
CheckPW = True
End Function