User's passwords _are_ case sensitive, if you're using Access's built in security. If you're using security with Access, you should use the built in security. Anything else will just involve you spending a lot of time building something that's not as secure as what's already there.
If you want the FAQ it's on my website.
Jeremy =============
Jeremy Wallace
AlphaBet City Dataworks
This could give you a starting place. My code assumes that you have the passwords stored in a table with the names and/or aliases of the users:
Dim bolAccepted As Boolean
Dim strPassword As String
Dim strStoredPassword As String
Dim rst As DAO.Recordset
Dim lngLength As Long
Dim intCounter As Integer
Set rst = CurrentDb.OpenRecordset("tblUsers", dbOpenDynaset)
bolAccepted = True
If rst.fldUser = txtUserName Then
strPassword = txtPassword
strStoredPassword = rst!fldPassword
If Len(strPassword) = Len(strStoredPassword) Then
lngLength = Len(strPassword)
For intCounter = 1 To lngLength
If Asc(Mid(strPassword, intCounter, 1)) <> Asc(Mid(strStoredPassword, intCounter, 1) Then
bolAccepted = False
Exit For
End If
Next intCounter
If bolAccepted = False Then
Call MsgBox("The passwords do not match. Remember they are case sensitive"
Else
Open form or whatever you want to do
End If
Else
Call MsgBox("The passwords do not match. Remember they are case sensitive"
End If
Else
Call MsgBox("The name you entered is not in the database"
End If
This function will need to actually search for the name (which I forgot to have it do) and you may want to add a form level variable to count and limit the number of attempts. Note, this code has not been tested. Particularly, I have checked ACCII values in years and the function Asc may be different now or had a name change. Look through Access help to find what you need if it doesn't work.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.