Solved

Count Checkboxes ticked in multiple forms

Posted on 2013-12-08
9
335 Views
Last Modified: 2013-12-08
Hi -

I have 6 forms which have about 10 questions each and roughly 4 tick boxes for each question.

I need to create a report which calculates the total number of times these tick boxes are clicked.  

For example, if I have 100 records and for question 1 on the first form the 'Confirmed' tick box was ticked, lets say, 67 times, then in the report, for this question and this tick box, it will display the sum 67.  Unfortunately, I have 6 forms and and lots of check boxes so I've got to do this for every tick box in every form :(

In the report, I have made the record source see all 6 tables and I've included all the tick boxes so the fields are available.

I use Access 2010.

some of the things I've tried adding to my report below in a text box.

Sum(IIf(Me![tbl_questions1.e1confirmed]=True,1,0))
=Count([tbl_questions.e1confirmed])

Hope this makes sense

Thanks.
0
Comment
Question by:CptPicard
  • 5
  • 4
9 Comments
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 500 total points
ID: 39704910
In the Footer (or Header) section of each form, use this as the control source for a Textbox called txtConfirmed:

= ABS(Sum([Confirmed]))

Open in new window


Make sure that Confirmed is the name of the field in the table (not the name of the checkbox on the form).


Then in the control source of a textbox on your report:

= Forms!Form1!txtConfirmed +  Forms!Form2!txtConfirmed  +  Forms!Form3!txtConfirmed  +  Forms!Form4!txtConfirmed  ... etc

Open in new window



And then use the same approach for each of the four checkboxes that you need to total.
0
 

Author Comment

by:CptPicard
ID: 39704931
I'm sure I've followed your instructions exactly but for some reason my text box just says #Name?

So I tried making it more simple and just typing in the text box

= Forms!Questions1!txtConfirmed

But that does the same.
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39704938
Are  you positive that you have the names exactly right:

FormName!Questions1

Textbox:  txtConfirmed

Are there any subforms involved?

And finally, for this method to work, the question forms need to be OPEN when you run the report.
0
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39704944
Another method would be to use this in the textbox control source.  I'm assuming your *table* names are Questions1, Questions2, etc (include the = sign in the control source):


= DCount("*", "Questions1", "Confirmed = TRUE") +  DCount("*", "Questions2", "Confirmed = TRUE") +  DCount("*", "Questions3", "Confirmed = TRUE")    etcetera

Open in new window


The forms do not need to remain open for this method.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:CptPicard
ID: 39704948
Yep it works fine when the forms are open but that's going to be a problem as the forms won't be open when users are trying to view the report?!  Anyway around this?
0
 

Author Comment

by:CptPicard
ID: 39704951
You just answered my question above.  Let me give this a go...
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39704959
Also... depending on the recordsource of your report, it might be a lot simpler.

You might be able to get by with this:

= ABS(Sum([e1Confirmed]))

Open in new window


That will work IF e1Confirmed is included as a field in your report's recordsource (not a checkbox), and it needs to be placed in a header or footer section.
0
 

Author Comment

by:CptPicard
ID: 39704961
Perfect Thanks
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39704980
Glad to help :)
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now