Base on option group value, disable a checkbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,
Thanks for reading this message and much appreciate if you could help.

I have an option group with two optional values: 1 and 2. I want when
checking on checkbox of the option group (in correspondence with value 1), it
will automatically disable other checkbox outside the option group.

----------- Option Group -------
[x] Value 1 [ ] Value 2
----------------------------------

[ ] Checkbox 1 ---> Disable
[ ] Checkbox 2

Could it be possible to apply for multiple checkboxes?
Could it be possible to disable another option group?

Thank u!!!

Thanh,
From Vietnam
 
Nguyen said:
I have an option group with two optional values: 1 and 2. I want when
checking on checkbox of the option group (in correspondence with value 1), it
will automatically disable other checkbox outside the option group.

----------- Option Group -------
[x] Value 1 [ ] Value 2
----------------------------------

[ ] Checkbox 1 ---> Disable
[ ] Checkbox 2

Could it be possible to apply for multiple checkboxes?
Could it be possible to disable another option group?


Use the Frame's AfterUpdate event

If Me.Frame = 1 Then
Me.othercheckbox.Enabled = False
Me.otherframe.Enable = False
. . .
End If

Don't forget to set those control's Enabled property to
True somewhere(?) else.
 
Dear Marshall,

Thanks for your prompt reply, I've got following:

Private Sub QA1_AfterUpdate()
If Me.QA1.Value = 1 Then
Me.Check600.Enabled = False
Else
Me.Check600.Enabled = True
End If
End Sub

But it doesn't work!

Hope someone could help!!!

Marshall Barton said:
Nguyen said:
I have an option group with two optional values: 1 and 2. I want when
checking on checkbox of the option group (in correspondence with value 1), it
will automatically disable other checkbox outside the option group.

----------- Option Group -------
[x] Value 1 [ ] Value 2
----------------------------------

[ ] Checkbox 1 ---> Disable
[ ] Checkbox 2

Could it be possible to apply for multiple checkboxes?
Could it be possible to disable another option group?


Use the Frame's AfterUpdate event

If Me.Frame = 1 Then
Me.othercheckbox.Enabled = False
Me.otherframe.Enable = False
. . .
End If

Don't forget to set those control's Enabled property to
True somewhere(?) else.
 
<Sigh> "Doesn't work" doesn't cut it.

Tell me what happened?

Are you sure that QA1 is the option group frame?
Did you place a break point in the code to see what the
values were? Did the code even get called?
--
Marsh
MVP [MS Access]


Thanks for your prompt reply, I've got following:

Private Sub QA1_AfterUpdate()
If Me.QA1.Value = 1 Then
Me.Check600.Enabled = False
Else
Me.Check600.Enabled = True
End If
End Sub

But it doesn't work!

Nguyen said:
I have an option group with two optional values: 1 and 2. I want when
checking on checkbox of the option group (in correspondence with value 1), it
will automatically disable other checkbox outside the option group.

----------- Option Group -------
[x] Value 1 [ ] Value 2
----------------------------------

[ ] Checkbox 1 ---> Disable
[ ] Checkbox 2

Could it be possible to apply for multiple checkboxes?
Could it be possible to disable another option group?
Marshall Barton said:
Use the Frame's AfterUpdate event

If Me.Frame = 1 Then
Me.othercheckbox.Enabled = False
Me.otherframe.Enable = False
. . .
End If

Don't forget to set those control's Enabled property to
True somewhere(?) else.
 
Dear Marshall
I notice that if I start with a blank database, then it is running OK! Then,
if I change name of the form and change code respectively, it says Error
(Can't find such of form).

I also see that it I delete some other forms, then name of my form appears
in drop-down list in the code window but it doesn't work well. I don't know
what's happening.

Marshall Barton said:
<Sigh> "Doesn't work" doesn't cut it.

Tell me what happened?

Are you sure that QA1 is the option group frame?
Did you place a break point in the code to see what the
values were? Did the code even get called?
--
Marsh
MVP [MS Access]


Thanks for your prompt reply, I've got following:

Private Sub QA1_AfterUpdate()
If Me.QA1.Value = 1 Then
Me.Check600.Enabled = False
Else
Me.Check600.Enabled = True
End If
End Sub

But it doesn't work!

Nguyen Trung Thanh wrote:
I have an option group with two optional values: 1 and 2. I want when
checking on checkbox of the option group (in correspondence with value 1), it
will automatically disable other checkbox outside the option group.

----------- Option Group -------
[x] Value 1 [ ] Value 2
----------------------------------

[ ] Checkbox 1 ---> Disable
[ ] Checkbox 2

Could it be possible to apply for multiple checkboxes?
Could it be possible to disable another option group?
Marshall Barton said:
Use the Frame's AfterUpdate event

If Me.Frame = 1 Then
Me.othercheckbox.Enabled = False
Me.otherframe.Enable = False
. . .
End If

Don't forget to set those control's Enabled property to
True somewhere(?) else.
 
The code you posted is logically and syntactically correct.
The only thing that can be wrong is the names of the various
controls. But I don't see where the name of the form comes
into it. If you are using different code now, then you
should post the code that you currently have.

Also, if you change the name of one object and things seem
to go crazy, make sure that you have turned off the Track
name AutoCorrect Info option in the main Access menu bar -
Tools - Options - General - Name AutoCorrect
Actually, unless you fully understand the implications of
this feature, you should never turn it on, it just causes
too much trouble.
 
Back
Top