On Mon, 19 Apr 2010 22:28:01 -0700, DontKnow
<(E-Mail Removed)> wrote:
>Hi Guys,
>
>Using the DCOUNT function I am receiving a n error!!
>
>strsql = DCount("[UserID]", "Exam", "[correct] = 'yes'")
>
>What am I doing wrong!! It is being used for the number of fields that have
>a Yes in the yes/no field. The error that IO receive is:
>
>Data type mismatch in the criteria expression.
>
>I can make this work when I use another field but I want to count the number
>of correct entries for a user??
>
>Any help greatly appreciated!!
>
>Cheers,
A Yes/No field isn't a text string; it's actually stored as a number, -1 for
Yes, 0 for No. It will never be equal to the text string 'yes'.
Since it's either TRUE or FALSE, and a criterion evaluates to either TRUE
(retrieve the record) or FALSE (don't), all you really need is
DCount("[UserID]", "Exam", "[Correct]")
although for readability you could also use the builtin constant True (not
'True' or "True", just the word True):
DCount("[UserID]", "Exam", "[Correct]=True")
--
John W. Vinson [MVP]
|