Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Writing a query for yes/no check marks.

Posted on 2011-03-03
7
Medium Priority
?
511 Views
Last Modified: 2013-11-28
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
Comment
Question by:gigifarrow
  • 3
  • 2
  • 2
7 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35027222
try this query

select [name], sum(iif([checkfield]=-1,1,0))
from tableX
group by [name]
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 35028189
Make this the controlsource of a new textbox on the form:

=DCount("YourYesNoField","YourTable","YourYesNoField=-1")
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35028373
Sorry, I just re-read your requirement:
=DCount("YourYesNoField","YourTable","YourYesNoField=-1" & " AND " & "YourNameField='Martin'")
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 35028448
why too many unnecessary "" and &

=DCount("YourYesNoField","YourTable","YourYesNoField=-1  AND [YourNameField]='Martin'")
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35029690
...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
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 35047172
Here is a little Totals query that counts True and False values for a Yes/No field:
qtotPreferredCount-Design-view.jpg
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 35047175
And here it is in datasheet view:
qtotPreferredCount-Datasheet-vie.jpg
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question