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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Error message



 
 
Thread Tools Display Modes
  #1  
Old October 17th, 2009, 04:16 PM posted to microsoft.public.access.forms
IowaHawkeye
external usenet poster
 
Posts: 1
Default #Error message

My problem is this. I am trying to create a field that counts the number of
"Yes" responses in a text field. I enter the following in the Control Source
of a text box that I place on my form:
=DCount("[TipsandTricks]","[ConfinedSpace]","Yes"). When I complete the
entry, I receive an #Error result in the text box I created to calculate the
number of "Yes" entries. What am I doing wrong?
  #2  
Old October 17th, 2009, 04:48 PM posted to microsoft.public.access.forms
Allen Browne
external usenet poster
 
Posts: 11,706
Default #Error message

You could try:
=DCount("*", "[ConfinedSpace]" ,"[TipsandTricks] = True")

But this may be quicker:
= - DSum("TipsandTricks", "[ConfinedSpace]")

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"IowaHawkeye" wrote in message
...
My problem is this. I am trying to create a field that counts the number
of
"Yes" responses in a text field. I enter the following in the Control
Source
of a text box that I place on my form:
=DCount("[TipsandTricks]","[ConfinedSpace]","Yes"). When I complete the
entry, I receive an #Error result in the text box I created to calculate
the
number of "Yes" entries. What am I doing wrong?


  #3  
Old October 17th, 2009, 04:59 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default #Error message

If [TipsandTricks] is the field with the Yes/No value and
[ConfinedSpace] is the table/query, then it should be;

=DCount("[TipsandTricks]","[ConfinedSpace]","[TipsandTricks] = 'Yes'")

Another option might be;

=Sum(Iif([TipsandTricks] = 'Yes', 1, 0))

--
_________

Sean Bailey


"IowaHawkeye" wrote:

My problem is this. I am trying to create a field that counts the number of
"Yes" responses in a text field. I enter the following in the Control Source
of a text box that I place on my form:
=DCount("[TipsandTricks]","[ConfinedSpace]","Yes"). When I complete the
entry, I receive an #Error result in the text box I created to calculate the
number of "Yes" entries. What am I doing wrong?

 




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 06:44 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.