Expression - Sum If Date Less than?

graceusguide

New member
Local time
Today, 02:01
Joined
Jan 10, 2010
Messages
6
Hi,

I have spent a long time trying to find the correct expression on a form. I am trying to have an unbound check box show me the sum of minutes of records that are dated 7 days prior to the current date. I currently have a text box on the header of summing Hours the hours and minutes fields to Minutes:
=Sum(([hours]*60)+([minutes]))
It is working great

What I would like is for this same expression but only where the 'service Date' Field is less than 7 days from today's date. I am not having much luck finding and IIF statement with the Date less than together. Can anyone help me?
 
I would do the calculations in a query, that way you can have a criteria in your Service Date field that says < Date()+7 or something, which will only return entries that are less than 7 days in the future
 
I would go with Sketchin's suggestion of putting this ([hours]*60)+[minutes] in the record source of your form.

But just for your edification this is how you can use IIF() with Sum():
Code:
=Sum(IIF([COLOR=red]Condition[/COLOR], [COLOR=red]True part[/COLOR], Null))
Only change the red parts.
 

Users who are viewing this thread

Back
Top Bottom