Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checkbox problem

Status
Not open for further replies.

12369874

MIS
Nov 30, 2001
12
GB
Help!
I have 6 checkboxes on a form, checkbox1, checkbox2, checkbox3, checkbox4, checkbox5, checkbox6.

Checkbox1 I want to assign the value 1
Checkbox2 I want to assign the value 2
Checkbox3 I want to assign the value 3
etc...
When I click on checkbox 1, 2 or 3 I want it to enter the value into a textbox called txtcalculate. This is not a problem until I want to unclick the checkbox to make another selection. The first checkbox I selected stays selected.
Another problem I have is with checkboxes 4,5,6. I want the selected value from one of these to multiply with the selected value from 1, 2 or 3.

Hope this makes sense, any help would be appreciated!
Cheers
Paul
 
It is possible to get around both these. For example, in the after-upadte event of each checkbox you can add code which cancels the value in the others. eg in the code for checkbox1 you would put:
Me.Checkbox2 = Null
Me.Checkbox3 = Null etc
and chenage the numbers for the others.

But, have you thought about using option groups instead? They only allow one value to be set at a time, so selecting another automatically cancels the previous selction.

Mulitplying the fields should not be a problem but would be easier of you went for option groups. Let's say you have a text box on your form called txtTotal. As I understand it you will want to multiply the value of just one of boxes 1,2 or 3 with one of boxes 4,5 or6. Using two option groups, one for 1,2&3 and one the 4,5&6, you could put in the AfterUpdate event of both something like this:
Me.txtTotal = Me.OptionGroup1*Me.OptionGroup2

HTH

Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top