Access checkboxes: point values

C

colvind

Beginning Access user here. Had a question that one would think would
be easy, but I am unable to figure out how to do it.

I have setup my table with fields. I have created a form and have
those fields linked to controls on the form. The form looks the way I
want it to.

The structure is that of a Quality Assurance form. It's got eight
sections and a number of questions under each section. These
questions are simply checkboxes that are checked if the person being
QA'd did it or left unchecked if not.

I'd like to be able to assign point values to each checkbox question,
such as if the box is checked, it's worth 4 points; if not, it's worth
0 points.

I'd like the form to add up the points gained in each section, then
the form's point total at the bottom of the form.

It sounds like this should be straightforward, but it probably isn't.
I'm not adverse to scripting or whathave you.

Any input would be good.

Thanks.
 
W

Wayne-I-M

Hi

It would be simple to just add 4 each time a tick box is check but I think
you will want to allow users to go back and correct the form if needed - they
may check a box by mistake.

So (there are other methods but this is a simple one) create a form to test
this then use it in your application if you like it.

On you form create an unbound textbox (called txtResults1) - Set the default
value to 0
add 3 check box boxes (CkeckBox1, CheckBox2 and CheckBo3)

Add an After Update event to each check box like this

Private Sub CheckBox1_AfterUpdate()
If Me.CheckBox1 = -1 Then
Me.txtResults1 = Me.txtResults1 + 4
Else
Me.txtResults1 = Me.txtResults1 - 4
End If
End Sub

Private Sub CheckBox2_AfterUpdate()
If Me.CheckBox2 = -1 Then
Me.txtResults1 = Me.txtResults1 + 4
Else
Me.txtResults1 = Me.txtResults1 - 4
End If
End Sub

Private Sub CheckBox3_AfterUpdate()
If Me.CheckBox3 = -1 Then
Me.txtResults1 = Me.txtResults1 + 4
Else
Me.txtResults1 = Me.txtResults1 - 4
End If
End Sub

Of course you will nee to aler this to bind the check boxes to your table.

Next I would not store the results but use an OnOpen of the form event to
add up the checks ad then set the value of the txtResults1 (or txtResults2 or
txtResults3 etc)

Hope this helps you on the way
 

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