Assign value to yes/no checkbox or text box

  • Thread starter ILoveAccess via AccessMonster.com
  • Start date
I

ILoveAccess via AccessMonster.com

I have 3 yes/no checkboxes (LowRisk, MediumRisk, HighRisk). I would like to
assign values to each box so that when the box is checked it equals a number
value.

Example: LowRisk (yes = 1)
MediumRisk (yes= 2)
HighRisk (yes= 3)


Then, I would like to add the numbers together for all boxes checked as "yes".


Is this possible?
 
D

Duane Hookom

Do you have a single field in a table table to store this? If the options
are exclusive then you only need one field and you can use an option group
on a form to make your selection. Bind the option group to your field name.

You can easily sum the field values in a totals report or in a report (or
group) header or footer section.
 
I

ILoveAccess via AccessMonster.com

I have 3 seperate checkboxes. How do Assign values to them?

Example:

LowRisk (wehn checked "yes", value =1)
MediumRisk (when checked "yes", value =2)
HighRisk (when checked "yes", value =3)

Duane said:
Do you have a single field in a table table to store this? If the options
are exclusive then you only need one field and you can use an option group
on a form to make your selection. Bind the option group to your field name.

You can easily sum the field values in a totals report or in a report (or
group) header or footer section.
I have 3 yes/no checkboxes (LowRisk, MediumRisk, HighRisk). I would like
to
[quoted text clipped - 10 lines]
Is this possible?
 
F

fredg

I have 3 seperate checkboxes. How do Assign values to them?

Example:

LowRisk (wehn checked "yes", value =1)
MediumRisk (when checked "yes", value =2)
HighRisk (when checked "yes", value =3)

Duane said:
Do you have a single field in a table table to store this? If the options
are exclusive then you only need one field and you can use an option group
on a form to make your selection. Bind the option group to your field name.

You can easily sum the field values in a totals report or in a report (or
group) header or footer section.
I have 3 yes/no checkboxes (LowRisk, MediumRisk, HighRisk). I would like
to
[quoted text clipped - 10 lines]
Is this possible?

You can't change the value of a check box field. It's either -1 or 0.

What you can do is use an unbound control and calculate the wanted
value to be displayed in a form or report.

I'm not clear from your first post if you want the sum of each check
box, or the total sum of all check boxes.
A checked check box value is -1, so....

Individual check box sums.

=ABS(Sum([LowRisk]))
=ABS(Sum([MediumRisk]*2))
=ABS(Sum([HighRisk]*3))

Or you could use
=Sum([LowRisk])*-1)
=Sum([MediumRisk])*-2)
=Sum([HighRisk])*-3)

If you want the total sum value of all checked boxes, then try:
= Sum([LowRisk]*-1+[MediumRisk]*-2+[HighRisk]*-3)

None of these calculations need be saved in any table.
 
D

Duane Hookom

You didn't understand my question. How do you plan use the information? Are
the controls bound to a field or fields in a table (have a control source)?
Or, are you just using the check boxes to set the criteria for a query?

--
Duane Hookom
MS Access MVP
--

ILoveAccess via AccessMonster.com said:
I have 3 seperate checkboxes. How do Assign values to them?

Example:

LowRisk (wehn checked "yes", value =1)
MediumRisk (when checked "yes", value =2)
HighRisk (when checked "yes", value =3)

Duane said:
Do you have a single field in a table table to store this? If the options
are exclusive then you only need one field and you can use an option group
on a form to make your selection. Bind the option group to your field
name.

You can easily sum the field values in a totals report or in a report (or
group) header or footer section.
I have 3 yes/no checkboxes (LowRisk, MediumRisk, HighRisk). I would like
to
[quoted text clipped - 10 lines]
Is this possible?
 
I

ILoveAccess via AccessMonster.com

Thank you thank you thank you!!! this was so easy, I though vba was going to
have to be written, but you fooled the system. Thank you!
I have 3 seperate checkboxes. How do Assign values to them?
[quoted text clipped - 16 lines]
You can't change the value of a check box field. It's either -1 or 0.

What you can do is use an unbound control and calculate the wanted
value to be displayed in a form or report.

I'm not clear from your first post if you want the sum of each check
box, or the total sum of all check boxes.
A checked check box value is -1, so....

Individual check box sums.

=ABS(Sum([LowRisk]))
=ABS(Sum([MediumRisk]*2))
=ABS(Sum([HighRisk]*3))

Or you could use
=Sum([LowRisk])*-1)
=Sum([MediumRisk])*-2)
=Sum([HighRisk])*-3)

If you want the total sum value of all checked boxes, then try:
= Sum([LowRisk]*-1+[MediumRisk]*-2+[HighRisk]*-3)

None of these calculations need be saved in any table.
 

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