count row

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

Guest

Hello,
In our database there is a string field in a time format such as HH:MM
(military format), my reportviewer display this to the user as it is. Now, on
the report, I need to count show number of row before 13:00 and after 13:00.
How can I do this?
Thanks,
Jim.
 
To display the Count of records with a [FieldName] value of <"13:00" in a
group or report footer, use a text box with a control source of:
Control Source: =Sum(Abs([FieldName]<"13:00"))
You may have issues if there are not leading zeros like "04:45". If this is
the case, you need to tell us.
 
JIM.H. said:
In our database there is a string field in a time format such as HH:MM
(military format), my reportviewer display this to the user as it is. Now, on
the report, I need to count show number of row before 13:00 and after 13:00.


Use a text box in the report footer with an expression like
this:
=Abs(Sum(CDate([timefield]) < #13:00#))
 
will this fail if there is no leading zero like 08:30am as 8:30? And why are
we using abs function?

Marshall Barton said:
JIM.H. said:
In our database there is a string field in a time format such as HH:MM
(military format), my reportviewer display this to the user as it is. Now, on
the report, I need to count show number of row before 13:00 and after 13:00.


Use a text box in the report footer with an expression like
this:
=Abs(Sum(CDate([timefield]) < #13:00#))
 
Avoiding the leading zero issue is the reason I used CDate.

True is internally represented by a -1. The Abs function
makes the result positive.
--
Marsh
MVP [MS Access]


JIM.H. said:
will this fail if there is no leading zero like 08:30am as 8:30? And why are
we using abs function?

Marshall Barton said:
Use a text box in the report footer with an expression like
this:
=Abs(Sum(CDate([timefield]) < #13:00#))
 
no, there is no leading zero if it is less then 10:00 am. what should I do?

Duane Hookom said:
To display the Count of records with a [FieldName] value of <"13:00" in a
group or report footer, use a text box with a control source of:
Control Source: =Sum(Abs([FieldName]<"13:00"))
You may have issues if there are not leading zeros like "04:45". If this is
the case, you need to tell us.

--
Duane Hookom
MS Access MVP
--

JIM.H. said:
Hello,
In our database there is a string field in a time format such as HH:MM
(military format), my reportviewer display this to the user as it is. Now,
on
the report, I need to count show number of row before 13:00 and after
13:00.
How can I do this?
Thanks,
Jim.
 
Go with Marshall's solution.

--
Duane Hookom
MS Access MVP
--

JIM.H. said:
no, there is no leading zero if it is less then 10:00 am. what should I
do?

Duane Hookom said:
To display the Count of records with a [FieldName] value of <"13:00" in a
group or report footer, use a text box with a control source of:
Control Source: =Sum(Abs([FieldName]<"13:00"))
You may have issues if there are not leading zeros like "04:45". If this
is
the case, you need to tell us.

--
Duane Hookom
MS Access MVP
--

JIM.H. said:
Hello,
In our database there is a string field in a time format such as HH:MM
(military format), my reportviewer display this to the user as it is.
Now,
on
the report, I need to count show number of row before 13:00 and after
13:00.
How can I do this?
Thanks,
Jim.
 
Back
Top