How do I count a counted field.

  • Thread starter Thread starter Robin Chapple
  • Start date Start date
R

Robin Chapple

I have a report listing members counted per country.

=Count([Country]) & IIf(Count([Country])=1," member in "," members
in ") & [Country]

This text box is named [Counted]

In the footer I added a text box with this:

=Count([Counted])

with the #Name? error

What have I done wrong?

Is there a way to "Count Unique [Country]" ?

Thanks,

Robin Chapple
 
=Count([Country]) & IIf(Count([Country])=1," member in "," members
in ") & [Country]

This text box is named [Counted]

In the footer I added a text box with this:

=Count([Counted])

with the #Name? error

What have I done wrong?

You can't have a function on a calculated field. Try:

=Count([Country]) & IIf(Count([Country])=1," member in"," members in") & "
all countries"

Tom Lake
 
There are a number of ways to do this; here's one:
Put a textbox in your detail section - or in the header where you have
[Counted].
I'll call it txtRunningSum.
Set its ControlSource like this:
=1
Set its RunningSum property to Over All.
This textbox should read 1 for the first country, 2 for the second, and so
on.
Once you've confirmed that it's really doing that, you can make it invisible
if you like.

Now put another textbox in the Report Footer.
I'll call it txtTotalSum
Set its ControlSource like this:
=[txtRunningSum]
It should show the value of txtRunningSum from the last record -
which I think is what you want.

HTH
- Turtle
 
Tom,

That gives "#Error" message.

Robin

=Count([Country]) & IIf(Count([Country])=1," member in "," members
in ") & [Country]

This text box is named [Counted]

In the footer I added a text box with this:

=Count([Counted])

with the #Name? error

What have I done wrong?

You can't have a function on a calculated field. Try:

=Count([Country]) & IIf(Count([Country])=1," member in"," members in") & "
all countries"

Tom Lake
 
Turtle,

That was very easy to follow your instructions and it worked first
time. I would never have got there by myself.

Many thanks,

Robin Chapple


There are a number of ways to do this; here's one:
Put a textbox in your detail section - or in the header where you have
[Counted].
I'll call it txtRunningSum.
Set its ControlSource like this:
=1
Set its RunningSum property to Over All.
This textbox should read 1 for the first country, 2 for the second, and so
on.
Once you've confirmed that it's really doing that, you can make it invisible
if you like.

Now put another textbox in the Report Footer.
I'll call it txtTotalSum
Set its ControlSource like this:
=[txtRunningSum]
It should show the value of txtRunningSum from the last record -
which I think is what you want.

HTH
- Turtle

Robin Chapple said:
I have a report listing members counted per country.

=Count([Country]) & IIf(Count([Country])=1," member in "," members
in ") & [Country]

This text box is named [Counted]

In the footer I added a text box with this:

=Count([Counted])

with the #Name? error

What have I done wrong?

Is there a way to "Count Unique [Country]" ?

Thanks,

Robin Chapple
 
Back
Top