log in form.

  • Thread starter Thread starter Playboy
  • Start date Start date
P

Playboy

I want to make a simple log in form for a non sensitive database
I have a form, when I press the command button "Log in" on the form,
want the data entered in the username: and password: text boxes to be
verifyed with the username and password fields in the Users table.
anyone know how to do this? the command button has no validate property
as i discovered...
 
Unbound Controls and some very simple VBA code employing the DLookup domain
aggregate function would be the easiest way.

Something like:

If Not IsNull(DLookup ("UserName","tblUser","[UserName] = """&
Me!txtLogInName & """")) Then
If Me!txtLogInPW = DLookup("UserPass","tblUser",","[UserName] = """&
Me!txtLogInName & """") Then
... it is OK, user is authorized
Else
... invalid password, take appropriate action
Else
... invalid user ID, take appropriate action
End If

Appropriate action might be to give them three tries and then Close the
LogIn form, for example, so someone can't just sit there and try all day to
guess a valid userid and password.

Larry Linson
Microsoft Access MVP
 
Back
Top