Type Mismatch

essence

Registered User.
Local time
Today, 10:51
Joined
Nov 20, 2006
Messages
21
I am getting a type mismatch error on this if statement.

If DCount("*", "tblEvaluation", "[ECycle] = " & Forms![frmSelectMgr]![Text42] And "[EvaluatorMgr] = " & txtRandomMgr) = 1 Then
MsgBox ("This user has already evaluated a manager")
End If

This piece of code is placed on a command button on a subform and is called "subformManager" and the Text42 is a numeric field on the main form "frmSelectMgr".

Please help!
 
you need the AND inside quotes

If DCount("*", "tblEvaluation", "[ECycle] = " & Forms![frmSelectMgr]![Text42] & " And [EvaluatorMgr] = " & txtRandomMgr) = 1 Then


note that your code also assumes BOTH variables to be numeric

ie text42 AND txtrandommgr
 
I am getting a type mismatch error on this if statement.

If DCount("*", "tblEvaluation", "[ECycle] = " & Forms![frmSelectMgr]![Text42] And "[EvaluatorMgr] = " & txtRandomMgr) = 1 Then
MsgBox ("This user has already evaluated a manager")
End If

This piece of code is placed on a command button on a subform and is called "subformManager" and the Text42 is a numeric field on the main form "frmSelectMgr".

Please help!

If DCount("*", "tblEvaluation", "[ECycle] = " & Forms![frmSelectMgr]![Text42] & " And [EvaluatorMgr] = " & txtRandomMgr) = 1 Then
MsgBox ("This user has already evaluated a manager")
End If
 

Users who are viewing this thread

Back
Top Bottom