PC Review


Reply
Thread Tools Rate Thread

Can conditional formatting be applied to checkboxes?

 
 
MariahJ
Guest
Posts: n/a
 
      9th Sep 2006
I want to enable/disable a checkbox on a continuous subform based on
the result of another checkbox, but I don't want the checkboxes all of
the records to be enabled/disabled. The only way I can think of to do
this would be with conditional formatting. Can I programmatically apply
conditional formatting to a checkbox?

Thanks.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2VuIFNoZXJpZGFu?=
Guest
Posts: n/a
 
      9th Sep 2006
If you set a control's Enabled property to False and its Locked property to
True then the appearance of the control will be unaltered, i.e. not greyed
out, but the user will not be able to edit it, or even move focus to it. So,
say you want a second bound check box to be inaccessible to the user if a
first one is True (checked) the add this function to the subform's (i.e. the
subform's underlying form object's) module:

Function LockControls()

Me.chkField2.Enabled = Not Me.chkField1
Me.chkField2.Locked = Me.chkField1

End Function

and set both the subform's Current event property and chkField1's
AfterUpdate event property to the following in the properties sheet:

= LockControls()

The one slight drawback of this would be that if a user checks the first
check box in one record then moves to a new (or indeed any other record)
record by clicking on the second check box the form's Current event won't
fire until after the click. This would mean that the second check box is
still inaccessible at the time of the first click, so the user would have to
click it again to check it. Focus would in fact be moved to the first
control in the form's tab order in this case as by clicking on the
inaccessible check box the user is actually just moving focus to the record,
not to the check box per se.

Ken Sheridan
Stafford, England

"MariahJ" wrote:

> I want to enable/disable a checkbox on a continuous subform based on
> the result of another checkbox, but I don't want the checkboxes all of
> the records to be enabled/disabled. The only way I can think of to do
> this would be with conditional formatting. Can I programmatically apply
> conditional formatting to a checkbox?
>
> Thanks.
>
>


 
Reply With Quote
 
MariahJ
Guest
Posts: n/a
 
      9th Sep 2006
That worked! Thanks!

I will try to play with changing the background color to see if I can
create the appearance of the field being disabled, but what you gave me
does the most important part, which is to prevent the user from
checking the box.

Ken Sheridan wrote:
> If you set a control's Enabled property to False and its Locked property to
> True then the appearance of the control will be unaltered, i.e. not greyed
> out, but the user will not be able to edit it, or even move focus to it. So,
> say you want a second bound check box to be inaccessible to the user if a
> first one is True (checked) the add this function to the subform's (i.e. the
> subform's underlying form object's) module:
>
> Function LockControls()
>
> Me.chkField2.Enabled = Not Me.chkField1
> Me.chkField2.Locked = Me.chkField1
>
> End Function
>
> and set both the subform's Current event property and chkField1's
> AfterUpdate event property to the following in the properties sheet:
>
> = LockControls()
>
> The one slight drawback of this would be that if a user checks the first
> check box in one record then moves to a new (or indeed any other record)
> record by clicking on the second check box the form's Current event won't
> fire until after the click. This would mean that the second check box is
> still inaccessible at the time of the first click, so the user would have to
> click it again to check it. Focus would in fact be moved to the first
> control in the form's tab order in this case as by clicking on the
> inaccessible check box the user is actually just moving focus to the record,
> not to the check box per se.
>
> Ken Sheridan
> Stafford, England
>
> "MariahJ" wrote:
>
> > I want to enable/disable a checkbox on a continuous subform based on
> > the result of another checkbox, but I don't want the checkboxes all of
> > the records to be enabled/disabled. The only way I can think of to do
> > this would be with conditional formatting. Can I programmatically apply
> > conditional formatting to a checkbox?
> >
> > Thanks.
> >
> >


 
Reply With Quote
 
=?Utf-8?B?S2VuIFNoZXJpZGFu?=
Guest
Posts: n/a
 
      10th Sep 2006
Check boxes don't support conditional formatting AFAIK so I think you'd have
to simulate one by using a text box and the Wingdings font. As it happens I
produced a small demo of how to create pseudo check boxes which can be sized
and formatted for a magazine article some years back. I've dug it up and
amended it to do something along the lines you want, and I'll email it to you
at the address in your profile.

If it doesn't arrive today mail me at:

ken<dot>sheridan<at>dsl<dot>pipex<dot>com

Ken Sheridan
Stafford, England

"MariahJ" wrote:

> That worked! Thanks!
>
> I will try to play with changing the background color to see if I can
> create the appearance of the field being disabled, but what you gave me
> does the most important part, which is to prevent the user from
> checking the box.
>


 
Reply With Quote
 
 
 
Reply

« Forms | Null values »
Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional Formatting Applied when Statement Not True Deanna Microsoft Excel Misc 6 23rd Sep 2009 04:14 PM
can conditional formatting be applied in more then three instance =?Utf-8?B?TWFyeSBqYW5l?= Microsoft Excel New Users 2 21st Dec 2005 04:02 AM
conditional Formatting using checkboxes macquarl Microsoft Excel Misc 1 6th Dec 2005 08:55 PM
How do I determine if conditional formatting is applied to an exc. =?Utf-8?B?TWFya1RoZU51a2U=?= Microsoft Excel Programming 17 16th Feb 2005 09:59 PM
Conditional formatting inconsistently applied Robin Microsoft Excel Worksheet Functions 1 2nd Apr 2004 04:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:25 PM.