See below in comments what my problem is:
Private Sub Command4_Click()
Dim strSQL As String
If IsNull(Me.txtLogin) Or Me.txtLogin = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtLogin.SetFocus
Exit Sub
End If
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
If strSQL = DLookup("[strEmpName]", "tblEmployees", "[strEmpName]='" & Forms!frmlogin!txtLogin & "'") Then
'The above is not doing what I think it should be doing
'I know I have a lot more coding but just trying to test this one part
'ok at this point if a name that is in the tblEmployees is there
'instead of it opening frmMain it jumps to the else and tells me
'Password Invalid why is it jumping to the else and what do I have
'to do at this point to get it to open frmMain if a name is in the table?
'Thanks in advance!
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmMain"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
Private Sub Command4_Click()
Dim strSQL As String
If IsNull(Me.txtLogin) Or Me.txtLogin = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtLogin.SetFocus
Exit Sub
End If
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
If strSQL = DLookup("[strEmpName]", "tblEmployees", "[strEmpName]='" & Forms!frmlogin!txtLogin & "'") Then
'The above is not doing what I think it should be doing
'I know I have a lot more coding but just trying to test this one part
'ok at this point if a name that is in the tblEmployees is there
'instead of it opening frmMain it jumps to the else and tells me
'Password Invalid why is it jumping to the else and what do I have
'to do at this point to get it to open frmMain if a name is in the table?
'Thanks in advance!
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmMain"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If