View Full Version : Trouble with control source statements


kblehman
05-21-2007, 08:09 AM
I have a summary report that is based on the primary data table. The report contains a number of fields that are filtered by a statement in their control source. I now need to add a second filter criteria to each statement, but I'm having trouble getting the correct results.

Each statement below needs to not only filter on the existing date criteria, it also needs to find records where NotifType=9.

STMT #1:
=Sum(Abs(Year([RecDate])=Year(Date())))

I changed it to this:
=Sum((Abs(Year([RecDate])=Year(Date()))) And ([NotifType]=9))

The correct result = 32, but the report shows -32. I assume I'm getting a negative number because of my parenthesis and have tried moving them around, but no luck.



These 2 statements also need to find records in the date range AND where NotifType=9.

STMT #2:
=Sum(Abs([RecDate] Between [Forms]![frmRptCriteria]![txtBeginDate] And [Forms]![frmRptCriteria]![txtEndDate]))


STMT #3:
=Sum(Abs([RecDate] Between ([Forms]![frmRptCriteria]![txtBeginDate]-365) And ([Forms]![frmRptCriteria]![txtEndDate]-365)))


Any help one of you code wizards can provide will be greatly appreciated.

Fifty2One
05-22-2007, 07:07 AM
if
=Sum(Abs(Year([RecDate])=Year(Date())))
gives you -32 wouldnt
=Sum(Abs(Year(Date())=Year([RecDate])))
give you 32???

kblehman
05-23-2007, 03:48 AM
I got it. Here's what worked:
=Sum(Abs(Year([RecDate])=Year(Date()) And ([NotifType]=9)))