Problem grouping a function

F

Fipp

Thanks to everyone helping me on this discussion group I used the following
function in a report. The function gets me the results that I wanted to get.
Now my problem is when I group my report by one or more fields the function
still returns the original answer as if my data was not grouped. the function
is as follows:

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

I am trying to group the data by 'year' and 'coverage'
 
M

Marshall Barton

Fipp said:
Thanks to everyone helping me on this discussion group I used the following
function in a report. The function gets me the results that I wanted to get.
Now my problem is when I group my report by one or more fields the function
still returns the original answer as if my data was not grouped. the function
is as follows:

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

I am trying to group the data by 'year' and 'coverage'


Don't use DCount if you can use Count or Sum. If you can't,
then explain why not.

Since we're already discussing this issue in another thread,
you should close out one or the other thread so the
interactions are all in one place.
 
F

Fipp

How would I make the following DCount function work using Count?

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

When I enter =Count("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B
1/3'")

I get a message saying: "The expression you entered has a function
containing the wrong number of arguments"

I apologize for my ignorance.

Marshall Barton said:
Fipp said:
Thanks to everyone helping me on this discussion group I used the following
function in a report. The function gets me the results that I wanted to get.
Now my problem is when I group my report by one or more fields the function
still returns the original answer as if my data was not grouped. the function
is as follows:

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

I am trying to group the data by 'year' and 'coverage'


Don't use DCount if you can use Count or Sum. If you can't,
then explain why not.

Since we're already discussing this issue in another thread,
you should close out one or the other thread so the
interactions are all in one place.
 
F

Fipp

Worked, Thanks for the help!

=Abs(Sum([passzone]="B 1/3" And [pres]="com"))

Fipp said:
How would I make the following DCount function work using Count?

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

When I enter =Count("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B
1/3'")

I get a message saying: "The expression you entered has a function
containing the wrong number of arguments"

I apologize for my ignorance.

Marshall Barton said:
Fipp said:
Thanks to everyone helping me on this discussion group I used the following
function in a report. The function gets me the results that I wanted to get.
Now my problem is when I group my report by one or more fields the function
still returns the original answer as if my data was not grouped. the function
is as follows:

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

I am trying to group the data by 'year' and 'coverage'


Don't use DCount if you can use Count or Sum. If you can't,
then explain why not.

Since we're already discussing this issue in another thread,
you should close out one or the other thread so the
interactions are all in one place.
 
M

Marshall Barton

Don't apologize for your ignorance, we're here to help you
conquer it ;-)

Try using any one of these expressions:

=Sum(IIf(pres = 'com' AND passzone = 'B 1/3', 1, 0))
or
=Count(IIf(pres = 'com' AND passzone = 'B 1/3', 1, Null))
or
=Abs(Sum(pres = 'com' AND passzone = 'B 1/3'))

I think the first two are easier to understand, but the
third one is a little faster.
--
Marsh
MVP [MS Access]

How would I make the following DCount function work using Count?

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

When I enter =Count("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B
1/3'")

I get a message saying: "The expression you entered has a function
containing the wrong number of arguments"

I apologize for my ignorance.

Fipp said:
Thanks to everyone helping me on this discussion group I used the following
function in a report. The function gets me the results that I wanted to get.
Now my problem is when I group my report by one or more fields the function
still returns the original answer as if my data was not grouped. the function
is as follows:

=DCount("[id]","All Pass","[pres] = 'com' AND [passzone] = 'B 1/3'")

I am trying to group the data by 'year' and 'coverage'
Marshall Barton said:
Don't use DCount if you can use Count or Sum. If you can't,
then explain why not.

Since we're already discussing this issue in another thread,
you should close out one or the other thread so the
interactions are all in one place.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top