total checked boxes on a form

V

veggiedi

Hi,
I'm working with an Access form where, in real time, someone will
observe a session, noting if specific activities occur across 12
five-minute time periods. For each time period, (act1_t1, act_1t2,
act1_t3, etc) there is a check box where, if the activity occurs, the
check box will be checked; if the activity doesn't occur, the check
box will be left blank.

I have gotten some code working with a command button that will
calculate a running total on the number of check boxes checked in a
total field (act1_total) -- the big problem is, this total is not
stored in the table that the form is created from!

What I ultimately need is a field, for each activity, on each
individual record, that gives me the total number of boxes checked
from act1_t1 through act1_t12 (activity #1, time periods one through
twelve) and then again for each subsequent activity and its time
periods on the record. I also need this total to be retained in the
data table so that the data can be exported and analyzed.

Thank you in advance for any help you may be able to offer!!
-diane
 
A

Arvin Meyer [MVP]

If you are storing the data from the fields, you can calculate the total on
the fly in a query, form, or report, and should NEVER store the total. If
you are not storing the 12 individual activities, you can store the total by
counting them in the form's After_Update event and storing the total in a
bound textbox. Instead of recounting, you can just use code to set the bound
box equal to the unbound one:

Sub Form_AfterUpdate()
Me.txtTableTotal = Me.txtFormTotal
End Sub
 
V

veggiedi

Thank you so much for your quick reply, I really appreciate it. I know
what you are saying about storing that value -- I did some reading up
on that as I tried to solve this iissue -- so that makes sense.

Your solution for using the after_update event, storing in a bound
texbox, and setting those as equal worked!! Thank you so very much!
-diane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top