DCount function in a report

F

Fipp

I tried the following function in a report and I am receiving an error message.


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

"All Pass" is a query

any suggestions?
 
F

fredg

I tried the following function in a report and I am receiving an error message.

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

"All Pass" is a query

any suggestions?

There is a difference between & and 'AND'.
Also, place [] around the table/query name, as you have a space within
the name, i.e. "[All Pass]"

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

Marshall Barton

Fipp said:
I tried the following function in a report and I am receiving an error message.


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

"All Pass" is a query


You need to use AND between the two conditions. Maybe like
this:

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

Fipp

Thank you all for your help. Using 'AND' took care of that problem. Now the
only problem that I am having is that it is not grouping those results within
the levels of the report? Will this function not allow grouping in a report?

I am trying to group the results by coverage and by year?

Marshall Barton said:
Fipp said:
I tried the following function in a report and I am receiving an error message.


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

"All Pass" is a query


You need to use AND between the two conditions. Maybe like
this:

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

Marshall Barton

Grouping? How does grouping relate to using DCount??

When you are counting a report's records, then you probably
should be using a Count or Sum function instead of DCount,
but I need to understand what you are counting.
--
Marsh
MVP [MS Access]

Thank you all for your help. Using 'AND' took care of that problem. Now the
only problem that I am having is that it is not grouping those results within
the levels of the report? Will this function not allow grouping in a report?

I am trying to group the results by coverage and by year?

Marshall Barton said:
Fipp said:
I tried the following function in a report and I am receiving an error message.


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

"All Pass" is a query


You need to use AND between the two conditions. Maybe like
this:

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

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