access report DCount function

L

LP

Hi there
in control source, I use
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' , etc)")
Is there a way of using the DCount function on more than one query instead
of doing
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryY","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryZ","[Field1] IN ('a' , 'd' , 'n' , etc)")
?
I have tried
=DCount("[Field1]","qryX" And "qryY" And "qryZ","[Field1] IN ('a' , 'd' ,
'n' , etc)")
but this does not work, nor does OR
regards
 
D

Duane Hookom

I would create a query that combines the three queries in a union query and
then use it in the DCount().
 
L

LP

Thank you for your reply. I understand that a union query does not update.
This would in this case create a problem.

Duane Hookom said:
I would create a query that combines the three queries in a union query and
then use it in the DCount().

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


LP said:
Hi there
in control source, I use
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' , etc)")
Is there a way of using the DCount function on more than one query instead
of doing
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryY","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryZ","[Field1] IN ('a' , 'd' , 'n' , etc)")
?
I have tried
=DCount("[Field1]","qryX" And "qryY" And "qryZ","[Field1] IN ('a' , 'd' ,
'n' , etc)")
but this does not work, nor does OR
regards
 
J

John Spencer

You cannot update the contents of a union query.
HOWEVER, the values returned by a union query are the values that are stored
in the table(s) at the time the query executes. So the values will change
if the data changes.

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

LP said:
Thank you for your reply. I understand that a union query does not update.
This would in this case create a problem.

Duane Hookom said:
I would create a query that combines the three queries in a union query
and
then use it in the DCount().

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


LP said:
Hi there
in control source, I use
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' , etc)")
Is there a way of using the DCount function on more than one query
instead
of doing
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryY","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryZ","[Field1] IN ('a' , 'd' , 'n' , etc)")
?
I have tried
=DCount("[Field1]","qryX" And "qryY" And "qryZ","[Field1] IN ('a' , 'd'
,
'n' , etc)")
but this does not work, nor does OR
regards
 
D

Duane Hookom

This is for a DCount() expression. There is no way this could be updated. A
union query (like other queries) will display the current records in all of
its source tables.

"does not update" isn't applicable in this discussion. If you have heard
that a union query is not updateable, this means that a user can't edit the
"live" records in a union query.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


LP said:
Thank you for your reply. I understand that a union query does not update.
This would in this case create a problem.

Duane Hookom said:
I would create a query that combines the three queries in a union query and
then use it in the DCount().

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


LP said:
Hi there
in control source, I use
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' , etc)")
Is there a way of using the DCount function on more than one query instead
of doing
=DCount("[Field1]","qryX","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryY","[Field1] IN ('a' , 'd' , 'n' ,
etc)")+DCount("[Field1]","qryZ","[Field1] IN ('a' , 'd' , 'n' , etc)")
?
I have tried
=DCount("[Field1]","qryX" And "qryY" And "qryZ","[Field1] IN ('a' , 'd' ,
'n' , etc)")
but this does not work, nor does OR
regards
 

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