Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Conditional formatting of checkbox?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CW - 18 Jan 2008 20:12 GMT
In Access 2003, is conditional formatting possible on a Y/N checkbox?
I have a fairly important checkbox that I would like to highlight in red if
checked, to grab the user's attention.
If it's not possible, any suggestions for other ways of doing this??
Many thanks
CW
fredg - 18 Jan 2008 20:33 GMT
> In Access 2003, is conditional formatting possible on a Y/N checkbox?
> I have a fairly important checkbox that I would like to highlight in red if
> checked, to grab the user's attention.
> If it's not possible, any suggestions for other ways of doing this??
> Many thanks
> CW

Check boxes are graphic images and are not resizable nor color
changeable.
What you can do is change the color of the check box label using code,
if you are using Single Form view.
Code the Check Box AfterUpdate event:
If Me.CheckBoxName = True then
  Me.CheckLabelName.BackColor = vbRed
  Me.CheckBoxLabel.ForeColor = vbYellow
Else
  Me.CheckLabelName.BackColor = vbWhite
  Me.CheckBoxLabel.ForeColor = vbBlack
End If

*** Place the same code in the form's Current event. ***

or .... you could place a rectangle around the check box, Send it to
Back, and change it's backcolor using similar code to the above.
Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

CW - 19 Jan 2008 12:21 GMT
Thanks Fred, that looks good and I can see myself using that or similar code
in a number of other scenarios
CW

> > In Access 2003, is conditional formatting possible on a Y/N checkbox?
> > I have a fairly important checkbox that I would like to highlight in red if
[quoted text clipped - 20 lines]
> or .... you could place a rectangle around the check box, Send it to
> Back, and change it's backcolor using similar code to the above.
Wayne-I-M - 18 Jan 2008 21:53 GMT
Or you could make a small text box and set the font to windings2 (P will give
you a tick).  

Signature

Wayne
Manchester, England.

> In Access 2003, is conditional formatting possible on a Y/N checkbox?
> I have a fairly important checkbox that I would like to highlight in red if
> checked, to grab the user's attention.
> If it's not possible, any suggestions for other ways of doing this??
> Many thanks
> CW
CW - 19 Jan 2008 12:20 GMT
Thanks Wayne
CW

> Or you could make a small text box and set the font to windings2 (P will give
> you a tick).  
[quoted text clipped - 5 lines]
> > Many thanks
> > CW
Ken Sheridan - 19 Jan 2008 18:26 GMT
Wayne's suggestion is the way to do it, but you need to do a little work:

1.  Add the real checkbox, bound to the Boolean field in the table, to the
form and set its Visible property to false.

2.  Add a text box sized to mimic a check box and set its FontName property
to Wingdings and its ControlSource property to:

=IIf([chkMyBooleanField],Chr(252),"")

where chkMyBooleanField is the name of the hidden real check box.

3.  Use condtional formatting to set the colours of the text box as required
on the basis of Expresssion Is  [chkMyBooleanField].

4.  Add a button over the text box and set its Transparent property to True,
and for its Click event procedure use the following code:

   Me!chkMyBooleanField = Not Me!chkMyBooleanField

When the user clicks the pseudo check box text box they will actually click
the button, which will set the value of the hidden real check box, and hence
the Boolean column it is bound to.  The expression used as the text box's
ControlSource property will show it checked or unchecked and the conditional
formatting will change its colours.

PCW magazine did publish a form of mine showing how this is done, along with
other formats for pseudo check boxes, but I don't imagine its on their site
now.  If you want a copy mail me at:

kenwsheridan<at>yahoo<dot>co<dot>uk

Ken Sheridan
Stafford, England

> Thanks Wayne
> CW
[quoted text clipped - 8 lines]
> > > Many thanks
> > > CW
CW - 20 Jan 2008 14:28 GMT
Ken - that's rather sneaky, and very creative. I will definitely give it a try.
Thanks
CW

> Wayne's suggestion is the way to do it, but you need to do a little work:
>
[quoted text clipped - 43 lines]
> > > > Many thanks
> > > > CW
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.