dbTalk Databases Forums  

Re: Disable/Enable checkbox with other checkbox

comp.database.ms-access comp.database.ms-access


Discuss Re: Disable/Enable checkbox with other checkbox in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ray
 
Posts: n/a

Default Re: Disable/Enable checkbox with other checkbox - 04-01-2004 , 07:52 AM






"Oswald" <fluffster71 (AT) hotmail (DOT) com> wrote

Quote:
Hello,

I have 2 checkboxes in a form: chk1 and chk2

Here's what I want:

If chk1 is checked, chk2 can be both checked or not checked...

If chk1 is not checked, chk2 can not be checked!

How can I do this?

Thanks,
Oswald
Hello Oswald,

Put the following code into the "OnCurrent" property of
the form your working on and edit the control names
to fit the check boxes that you are using.

If chkCheck01.Value = -1 Then
chkCheck02.Enabled = True
Else
chkCheck02.Enabled = False
End If

What happens is, as you go from record to record
in your form, it checks to see if chkCheck01 has
been selected. If so, then chkCheck02 is enabled
else it is disabled.

Regards,

Ray


Reply With Quote
  #2  
Old   
Amber S.
 
Posts: n/a

Default Re: Disable/Enable checkbox with other checkbox - 04-01-2004 , 12:22 PM






"Oswald" <fluffster71 (AT) hotmail (DOT) com> wrote

Quote:
Hello,

I have 2 checkboxes in a form: chk1 and chk2

Here's what I want:

If chk1 is checked, chk2 can be both checked or not checked...

If chk1 is not checked, chk2 can not be checked!

How can I do this?

Thanks,
Oswald
************************************************** ***********
Hi Oswald,

Go to the chk2 checkbox properties, click on the data tab and set the
enabled property to no. Next go to the click even of chk1 checkbox
and put this code in:

if me.chk1 = true then
me.chk2.enabled = true 'to enable it and allow it to be checked
else
me.chk2.enabled = false 'to disable it and not allow it to be
checked
end if

This should do the trick.
Amber


Reply With Quote
  #3  
Old   
Oswald
 
Posts: n/a

Default Re: Disable/Enable checkbox with other checkbox - 04-04-2004 , 12:41 PM




"Amber S." <amber_smith (AT) centraltechnology (DOT) net> wrote

Quote:
"Oswald" <fluffster71 (AT) hotmail (DOT) com> wrote

Hello,

I have 2 checkboxes in a form: chk1 and chk2

Here's what I want:

If chk1 is checked, chk2 can be both checked or not checked...

If chk1 is not checked, chk2 can not be checked!

How can I do this?

Thanks,
Oswald

************************************************** ***********
Hi Oswald,

Go to the chk2 checkbox properties, click on the data tab and set the
enabled property to no. Next go to the click even of chk1 checkbox
and put this code in:

if me.chk1 = true then
me.chk2.enabled = true 'to enable it and allow it to be checked
else
me.chk2.enabled = false 'to disable it and not allow it to be
checked
end if

This should do the trick.
Amber
Hey Amber,

this really helped me out!!

I did change it to:

Quote:
if me.chk1 = true then
me.chk2.enabled = true 'to enable it and allow it to be checked
else
me.chk2.enabled = false 'to disable it and not allow it to be
checked
me.chk2 = false 'to make sure that if chk2 is checked, chk2 is
unchecked when chk1 is unchecked
Quote:
end if
Thank you,
Oswald




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.