count of txt boxes that have a greater value than 0 (1 Viewer)

shutzy

Registered User.
Local time
Today, 21:50
Joined
Sep 14, 2011
Messages
775
i have a report and at the footer i want to show how many of the txt boxes i have are >0

i tried

=Count([txtbox]>0)

i know that this is quite simple but i just cant get it

thanks
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:50
Joined
Aug 30, 2003
Messages
36,127
=Sum(IIf([txtbox] > 0, 1, 0))
 

shutzy

Registered User.
Local time
Today, 21:50
Joined
Sep 14, 2011
Messages
775
thanks for your reply. i tried your expression and when i open the report i get

'Enter parameter value'
txt box

i i dont input anything into the box i get a zero in the txt box that has the SUM expression.

any ideas?
 

JHB

Have been here a while
Local time
Today, 22:50
Joined
Jun 17, 2012
Messages
7,732
What is the exactly name of the text box you try to sum, is it "txtbox", "txt box" or ...?
 

shutzy

Registered User.
Local time
Today, 21:50
Joined
Sep 14, 2011
Messages
775
the exact name is txtClientCountVisited
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:50
Joined
Aug 30, 2003
Messages
36,127
So did you try with that name? I copied what you posted.

And you'd probably want a field name rather than a textbox name, but it may work.
 

shutzy

Registered User.
Local time
Today, 21:50
Joined
Sep 14, 2011
Messages
775
hi, yes i did try it with the correct txt box name. ive just tried it again and i get the same error. does it matter where on the report i put it?

i did initially think that it was down to me using a DCount in a text box. so i moved the dcount to the report record source
 

JHB

Have been here a while
Local time
Today, 22:50
Joined
Jun 17, 2012
Messages
7,732
If you didn't got it, post a stripped version of you database with some sample data.
 

shutzy

Registered User.
Local time
Today, 21:50
Joined
Sep 14, 2011
Messages
775
ive attached the report needed and the tables that are required.

if you open the report you will see what i mean.

cant believe i had to zip the file to get it to upload. theres only 3 tbls and one report and it was > 2mb.
 

Attachments

  • ReportCount.zip
    585.4 KB · Views: 53

pbaldy

Wino Moderator
Staff member
Local time
Today, 13:50
Joined
Aug 30, 2003
Messages
36,127
You can't sum a calculated control, so you can move that calculation to the query the report is based on, use the Running Sum property of another textbox, or:

=Sum(IIf(DCount("[OrderID]","[tblOrders]","[ClientDetailsID]= " & [ClientDetailsID] & " and [Status] =3 and [OrderDate]<Date()")>0,1,0))
 

Users who are viewing this thread

Top Bottom