A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DCount with one single condition works, but several ones, joined together with the logical operator AND, do not!



 
 
Thread Tools Display Modes
  #1  
Old February 9th, 2010, 05:51 PM posted to microsoft.public.access.gettingstarted
Henrik Jansson
external usenet poster
 
Posts: 8
Default DCount with one single condition works, but several ones, joined together with the logical operator AND, do not!

Dear friends out there,

I simply do not understand this. What's wrong with the syntax in my
Access-2007 report?

=DCount("[ID]", "Table", "[ConditionYesNo1] = No") ----- returns a correct
minor total of all records with no checkmarks in the field (column)
"ConditionYesNo1".

=DCount("[ID]", "Table", "[ConditionYesNo1] = No" AND "[ConditionYesNo2] =
No" ) ----- returns ALL records. Why i that?

Thanks in advance

Henrik


__________ Information från ESET NOD32 Antivirus, version av virussignaturdatabas 4848 (20100208) __________

Meddelandet har kontrollerats av ESET NOD32 Antivirus.

http://www.esetscandinavia.com



  #2  
Old February 9th, 2010, 06:05 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default DCount with one single condition works, but several ones, joinedtogether with the logical operator AND, do not!

Try the following correctly formatted argument.

=DCount("[ID]", "Table", "[ConditionYesNo1] = No AND [ConditionYesNo2] = No" )


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Henrik Jansson wrote:
Dear friends out there,

I simply do not understand this. What's wrong with the syntax in my
Access-2007 report?

=DCount("[ID]", "Table", "[ConditionYesNo1] = No") ----- returns a
correct minor total of all records with no checkmarks in the field
(column) "ConditionYesNo1".

=DCount("[ID]", "Table", "[ConditionYesNo1] = No" AND "[ConditionYesNo2]
= No" ) ----- returns ALL records. Why i that?

Thanks in advance

Henrik

__________ Information från ESET NOD32 Antivirus, version av
virussignaturdatabas 4848 (20100208) __________

Meddelandet har kontrollerats av ESET NOD32 Antivirus.

http://www.esetscandinavia.com



  #3  
Old February 9th, 2010, 06:41 PM posted to microsoft.public.access.gettingstarted
Duane Hookom
external usenet poster
 
Posts: 7,177
Default DCount with one single condition works, but several ones, joined t

You made it more complex than required:

=DCount("[ID]", "Table", "[ConditionYesNo1] = 0 AND [ConditionYesNo2] = 0" )

You could also try
=DCount("[ID]", "Table", "[ConditionYesNo1] + [ConditionYesNo2] = 0" )

--
Duane Hookom
Microsoft Access MVP


"Henrik Jansson" wrote:

Dear friends out there,

I simply do not understand this. What's wrong with the syntax in my
Access-2007 report?

=DCount("[ID]", "Table", "[ConditionYesNo1] = No") ----- returns a correct
minor total of all records with no checkmarks in the field (column)
"ConditionYesNo1".

=DCount("[ID]", "Table", "[ConditionYesNo1] = No" AND "[ConditionYesNo2] =
No" ) ----- returns ALL records. Why i that?

Thanks in advance

Henrik


__________ Information från ESET NOD32 Antivirus, version av virussignaturdatabas 4848 (20100208) __________

Meddelandet har kontrollerats av ESET NOD32 Antivirus.

http://www.esetscandinavia.com



.

  #4  
Old February 9th, 2010, 07:16 PM posted to microsoft.public.access.gettingstarted
Henrik Jansson
external usenet poster
 
Posts: 8
Default DCount with one single condition works, but several ones, joined together with the logical operator AND, do not!

Thank you so much John! That solved my problem.

Best regards,

Henrik

"John Spencer" skrev i meddelandet
...
Try the following correctly formatted argument.

=DCount("[ID]", "Table", "[ConditionYesNo1] = No AND [ConditionYesNo2] =
No" )


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

Henrik Jansson wrote:
Dear friends out there,

I simply do not understand this. What's wrong with the syntax in my
Access-2007 report?

=DCount("[ID]", "Table", "[ConditionYesNo1] = No") ----- returns a
correct minor total of all records with no checkmarks in the field
(column) "ConditionYesNo1".

=DCount("[ID]", "Table", "[ConditionYesNo1] = No" AND "[ConditionYesNo2]
= No" ) ----- returns ALL records. Why i that?

Thanks in advance

Henrik

__________ Information från ESET NOD32 Antivirus, version av
virussignaturdatabas 4848 (20100208) __________

Meddelandet har kontrollerats av ESET NOD32 Antivirus.

http://www.esetscandinavia.com




__________ Information från ESET NOD32 Antivirus, version av
virussignaturdatabas 4848 (20100208) __________

Meddelandet har kontrollerats av ESET NOD32 Antivirus.

http://www.esetscandinavia.com





__________ Information från ESET NOD32 Antivirus, version av virussignaturdatabas 4848 (20100208) __________

Meddelandet har kontrollerats av ESET NOD32 Antivirus.

http://www.esetscandinavia.com



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:43 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.