Question How to work on a CheckBox

wongray

Registered User.
Local time
Today, 16:28
Joined
Jan 28, 2009
Messages
15
Hello,

I have a question that I hope you can help me.

I got 5 check box in my database and I would like to make it where if I click on 1 of the check box, the other 4 check box will not be checked.

For example,

Check 1, 2, 3, 4, 5

if I click on check 2, 1,3,4,5 will be empty
If I click on check 3, 1,2,4,5 will be empty.

Please advice.. many many thanks
Ray
 
On the AfterUpdate event of the checkbox, suppose in this case its the first one ..

Code:
If Me.chkCheckBox1 = True then
    Me.chkCheckBox2 = False
    Me.chkCheckBox3 = False
    Me.chkCheckBox4 = False
    Me.chkCheckBox5 = False
End If

And so on for each of them.

-dK
 
From the sound of it, you might consider a single field and an option group to select the appropriate option.
 
Agree with Paul or Pat. I thought about this, but didn't mention it but just for anyone's edification here was a situation I have been in ....

I argued this with the data analyst who made an argument similar to the following. Suppose 3 checkboxes. An option group would have the value of 1, 2, or 3. On the backside of the calculations - each field would need to be divided by it's value in order to determine the true number of 'positives' or else the total value would be weighted. I didn't see a problem with this but the analysts 'would have to remember one more thing!' and wanted the data as clean and as true as possible.

In essence it doesn't matter if I Abs(), Count() = x or Total/Value because a step (or calculation) is still required for data export to put the data in terms for metrics.

I don't consider optimization a factor since all code is suspended while people are selecting stuff anyhow and think that it is a choice of personal preference to remember what to apply to the export for true data rendering. I normally go with the seperate checkboxes if there is a ton of things going on so I don't have to write everything out - option #2 has this set of values, ..., option #26 has this set. If I am one- or two-foring then I do the option group.

-dK
 
Last edited:
Hello, this work perfectly.. many thanks


On the AfterUpdate event of the checkbox, suppose in this case its the first one ..

Code:
If Me.chkCheckBox1 = True then
    Me.chkCheckBox2 = False
    Me.chkCheckBox3 = False
    Me.chkCheckBox4 = False
    Me.chkCheckBox5 = False
End If

And so on for each of them.

-dK
 
Yes, wongray would be good to redesign and not use the suggestion by dkinley. wongray (don't become known as WRONGway). Listen to Pat and Paul and use ONE field with an OPTION GROUP that stores ONE value, and not five different fields.
 
For the Option Group doesn't the position of the controls on the form need to be considered?

I must admit I use the DKinley principle for making changes to labels/fields when one of them is "clicked"
 

Users who are viewing this thread

Back
Top Bottom