P
Phil
Hi,
I have a form where the user selects a grade from a combo box (cboGrade),
selects a status using a check box (ckStatusCurrent) and then clicks on a
command button which counts the students matching the criteria selected.
[Grade] and [Status] are fields in a Students table.
If I set my stcriteria as 3 separate criterias as follows I get the
right count for each criteria
' strcriteria = "[ckStatusCurrent] = -1"
' strcriteria = "[Grade] = " & "[cboGrade]"
' strcriteria = "[Status] = 'Current'"
If the ckStatusCurrent box is checked and the students [Grade] matches
the [cboGrade] and the students [Status] is 'Current' I want to count
the student.
If I try to COMBINE the criteria into one to restrict using the combination
of the three I always get a DCount of zero. There are students that meet
the selected grade and have a "Current" status and the check box is
checked.
Here is my combined strcriteria:
strcriteria = "[Grade] = " & "[cboGrade]" & " & [Status] = 'Current'" _
& " & [ckStatusCurrent] = -1"
intx = DCount("[Student_Key]", "Students", strcriteria)
If (intx = 0) Then
MsgBox "No students for the grade and status selected", , "Report
Menu"
GoTo Exit_VSelectedGrade_Click
End If
What am I missing????????????
Thanks,
I have a form where the user selects a grade from a combo box (cboGrade),
selects a status using a check box (ckStatusCurrent) and then clicks on a
command button which counts the students matching the criteria selected.
[Grade] and [Status] are fields in a Students table.
If I set my stcriteria as 3 separate criterias as follows I get the
right count for each criteria
' strcriteria = "[ckStatusCurrent] = -1"
' strcriteria = "[Grade] = " & "[cboGrade]"
' strcriteria = "[Status] = 'Current'"
If the ckStatusCurrent box is checked and the students [Grade] matches
the [cboGrade] and the students [Status] is 'Current' I want to count
the student.
If I try to COMBINE the criteria into one to restrict using the combination
of the three I always get a DCount of zero. There are students that meet
the selected grade and have a "Current" status and the check box is
checked.
Here is my combined strcriteria:
strcriteria = "[Grade] = " & "[cboGrade]" & " & [Status] = 'Current'" _
& " & [ckStatusCurrent] = -1"
intx = DCount("[Student_Key]", "Students", strcriteria)
If (intx = 0) Then
MsgBox "No students for the grade and status selected", , "Report
Menu"
GoTo Exit_VSelectedGrade_Click
End If
What am I missing????????????
Thanks,