If Between Two Times, Then...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to write an expression like the one below:


Sum(IIf([ISSUETIME] Between 7:01:00 AM and 3:00:00 PM,[EXTENDEDCOST],""))

Unfortunately, it is not working. The reason I write the times like I do in
the statement above is because that is the way they are written in the column
of data I am querying. Does anybody out there know how to make this work?
Thanks.
 
Suggestions:
1. Use the # as delimiter around the time values.

2. Return a zero (not a zero-length string) for the value to sum if the
condition is not met.

Sum(IIf([ISSUETIME] Between #7:01:00 AM# and #3:00:00 PM#, [EXTENDEDCOST],
0))

I am assuming that:
a) This goes in the context of a query.
b) IssueTime is a date/time field with no date component.
c) ExtendedCost is a numeric field of some kind.
 
Back
Top