Hi!
I use a table with the user's name or LAN identity, a password, and a security level. The login form will have the standard two text boxes and two buttons(one is to quit Access). I use the following code in the form:
Option Compare Database
Option Explicit
Private fTries As Byte
Private Sub cmdEnter_Click()
'This procedure will check the password with the name and
'will open the main menu if they match. If no match occurs
'after three tries Access is exited
'Declare local variables
Dim dbsTestbase As DAO.Database
Dim rstUsers As DAO.Recordset
Dim UserName As String
Dim UserPassword As String
'Validate existance of information on the form
If Nz(Len(txtName), 0) = 0 Then
Call MsgBox("You must enter a name", vbOKOnly + vbInformation _
, "No Name Entered"

Call txtName.SetFocus
GoTo ExitSub
End If
If Nz(Len(txtPassword), 0) = 0 Then
Call MsgBox("You must enter a password", vbOKOnly + vbInformation _
, "No Password Entered"

Call txtPassword.SetFocus
GoTo ExitSub
End If
'Set object variables
Set dbsTestbase = CurrentDb
Set rstUsers = dbsTestbase.OpenRecordset("tblUsers", dbOpenDynaset)
'Store form information in local variables
UserName = txtName
UserPassword = txtPassword
'Test for name and password match
rstUsers.FindFirst "fldUserName = " & Quote & UserName & Quote
If rstUsers.NoMatch Then
Call MsgBox("The name you have entered is not in the official " & _
"users file. Try entering the name again. If you " & _
"are sure the name is correct, exit Access and call " & _
"the system administrator", vbInformation, "Name not Matched"

Call txtName.SetFocus
fTries = fTries + 1
Else
If rstUsers!fldUserPassword = UserPassword Then
Forms!frmParameters!txtSecurity = rstUsers!fldSecurity
Forms!frmParameters!txtName = UserName
DoCmd.OpenForm "frmMainMenu"
DoCmd.Close acForm, "frmPassword"
Else
Call MsgBox("The password you have entered does not match " & _
"the name you entered. Please re-enter the " & _
"password. If you are sure the password you " & _
"entered is correct, please call your system " & _
"administrator", vbInformation, "Password Incorrect"

Call txtPassword.SetFocus
fTries = fTries + 1
End If
End If
ExitSub:
'Test number of tries
If fTries > 3 Then
Call MsgBox("You have tried three incorrect combinations. " & _
"Access will now exit the database", vbCritical)
Call cmdExit_Click
End If
'Close object variables
Set rstUsers = Nothing
Set dbsTestbase = Nothing
End Sub
Private Sub cmdExit_Click()
'This procedure will exit Access
DoCmd.Quit
End Sub
Private Sub Form_Load()
'Initiates form level variable
fTries = 1
End Sub
As you can see, I also have a form called parameters where I store information that you might normally store in global variables. I think this method works better. This code will also exit Access after three failed tries.
hth
Jeff Bridgham