473,395 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Counting multiple checkboxes in a record

Greetings. I administer a membership database for a rod and gun club I belong to. In the contacts table I have several fields including member name, member id number, etc. In the same record there are check boxes for what they are interested in. i.e. Archery, Rifle, Fishing, etc.
What I'm looking to do is get a count of each of the interests. The outcome should be Count of Archery is 123, count of rifle is 321, count of fishing is 222.
I'm thinking a query may be best. That way I can take the data and generate a graph.

Thanks in advance, any help is appreciated.

Version is Access 2013. I'm not afraid to use vba either if that is the best way.
Dec 22 '13 #1
5 1716
zmbd
5,501 Expert Mod 4TB
maconstable:
Your database isn't normalized and this results in making what you want to much more difficult : > Database Normalization and Table Structures.

There is a way to do what you want for the counts; however, it's a very tedious and overly complex method. It involves a series of "iif()" "NZ()" and a "Sum()" in a caculated field. Fine if you'll never ever ever add another interest but a real pain to maintain AND you'll have to have this series of calcs for each interest that your after and so forth...

Here's what I advise:
1) read the link I provided above. If you get lost don't worry, ask here and we'll get you thru it.

2) One table for the customers/clients

3) One table that lists interest

4) A table that links the customers to the the interests.

5) in the table relationships tool we establish the relationshops between these three tables.

6) We build the queries based on the table in (4) pulling by customer and/or interest as needed.

Sorry I'm on my way out the door or I'd provide some more detail and I'm sure Rabbit or Neopa will be along shortly.
Dec 22 '13 #2
ADezii
8,834 Expert 8TB
This is a relatively simple matter if you are looking for the Totals only. The solution involves a Totals Query consisting of the actual Field Name itself as a Calculated Field, and Expression in the Total Row. Each Column of the Totals Query would look like:
Expand|Select|Wrap|Line Numbers
  1. Archery: Abs(Sum([Contacts].[Archery]))
  2. Rifle: Abs(Sum([Contacts].[Rifle]))
  3. Fishing: Abs(Sum([Contacts].[Fishing]))
  4.  
The SQL Statement for these three Fields only would be:
Expand|Select|Wrap|Line Numbers
  1. SELECT Abs(Sum([Contacts].[Archery])) AS Archery, Abs(Sum(Contacts.Rifle)) AS Rifle, 
  2. Abs(Sum(Contacts.Fishing)) AS Fishing
  3. FROM Contacts;
  4.  
A Graph should easily be generated from this Query.
Dec 23 '13 #3
zmbd
5,501 Expert Mod 4TB
ADezii,
Here I am making it too difficult (lol)

And for the indiviual records:
Expand|Select|Wrap|Line Numbers
  1. SELECT contacts.contacts_pk
  2.    , Abs([archery]+[Rifle]+[fishing]) AS zsum
  3. FROM contacts;
I still think the DB isn't normalized.
Dec 23 '13 #4
ADezii
8,834 Expert 8TB
I'm sure that I am going to get negative feedback on this one, but Normalization isn't always desirable or practical.
Dec 23 '13 #5
zmbd
5,501 Expert Mod 4TB
@A: Not from me... (^_^) - I have a few databases where I've had to flatten the data, usually for a required dataentry form. For some reason, no-one thought a CTQ style select query would be needed, sigh.
Dec 23 '13 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: jeffsnox | last post by:
Hi, I have multiple checkboxes on the same form as follows: <input type='checkbox' name='cbtype' value='1'> <input type='checkbox' name='cbtype' value='2'> <input type='checkbox'...
4
by: ramapv | last post by:
can i highlight a checkbox from a group of checkbox with particular name which is given as a search key. I am having a list of checkboxes and i have to select some of them and form a group.but i'm...
4
by: favor08 | last post by:
I have a continious subform that 9000 + records and I have serveral check marks on the subform. so it ties to that record. Does anyone have any examples were they use multiple checkboxes in a ...
0
by: serghei | last post by:
I have already the insert form and the database. It's working to insert multiple data with multiple checkboxes. But I can't retrieve multiple data.
0
by: Ned Balzer | last post by:
Hi, Can anyone point me in the direction of a solution for validating multiple checkboxes in an asp.net 2.0 page? 1) This is not a checkboxlist, it is a number of separate checkboxes 2) I do...
3
by: santoshjsh | last post by:
hello everyone, i have a gridview in which i have multiple checkboxes in a single column. means for every row in the gridview i have four checkboxes in one column e.g Add, Delete, Print,...
3
by: raamay | last post by:
hey experts, please advise me what is the best way to save multiple checkboxes value in a database. I have 6 checkboxes and i came across storing the values in a single column of a table which i dont...
0
by: kimmelsd33 | last post by:
I am adding to my software. I have placed about 30 checkboxes on a form. Based on which checkboxes are selected, I want to print the values to a tab delimited text file. For instance, the first...
12
by: BabyLucifer666 | last post by:
Hello All, (using Access2000) I have a form with multiple unbound checkboxes. What I would like to do is have the user check whoever needs to take a specific training course. My database is...
5
by: pavan52 | last post by:
I have 1 form in with multiple checkboxes in it (each with the code): <input type="checkbox" value="$cat_tit" name="check_list" id="cat_title" /> How would I be able to tell which checkboxes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.