Private Sub cmdLogin_Click()
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password to see if this
'matches value chosen in combo box
If Me.txtPassword.Value = DLookup("password", "tblUsers", _
"[ID]=" & Me.cboUsername.Value) Then
ID = cboUsername
'Close logon form and open loginmenu form
strLoginName = Me.cboUsername
DoCmd.Close acForm, "Login"
DoCmd.OpenForm "LoginMenu"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.txtPassword.SetFocus
End If
End Sub