• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 522
  • Last Modified:

Writing a query for yes/no check marks.

I have a voting database I need to find out total of yes check marks for each voter. I then need to place that total on a form that just shows total of yes checks. Do I have to create a button on the form to find the total, or is there a way I can just show the total number on my form. Example:

total Yes for Martin is: 3    and so on
0
gigifarrow
Asked:
gigifarrow
  • 3
  • 2
  • 2
1 Solution
 
Rey Obrero (Capricorn1)Commented:
try this query

select [name], sum(iif([checkfield]=-1,1,0))
from tableX
group by [name]
0
 
Jeffrey CoachmanMIS LiasonCommented:
Make this the controlsource of a new textbox on the form:

=DCount("YourYesNoField","YourTable","YourYesNoField=-1")
0
 
Jeffrey CoachmanMIS LiasonCommented:
Sorry, I just re-read your requirement:
=DCount("YourYesNoField","YourTable","YourYesNoField=-1" & " AND " & "YourNameField='Martin'")
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
Rey Obrero (Capricorn1)Commented:
why too many unnecessary "" and &

=DCount("YourYesNoField","YourTable","YourYesNoField=-1  AND [YourNameField]='Martin'")
0
 
Jeffrey CoachmanMIS LiasonCommented:
...Just so I can separate out each criteria segment while building the complete Criteria argument...
Thus making it easier to troubleshoot.
As you know these can get quite complex...
So for a person starting out this may make more sense.



0
 
Helen FeddemaCommented:
Here is a little Totals query that counts True and False values for a Yes/No field:
qtotPreferredCount-Design-view.jpg
0
 
Helen FeddemaCommented:
And here it is in datasheet view:
qtotPreferredCount-Datasheet-vie.jpg
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now