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 / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Check Boxes Have Label Controls That 'Work'

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Access User - 12 Mar 2008 19:21 GMT
In developing this form, I created a bunch of check-boxes with "Yes" as their
defaults. Let's say one is called 'PCA_L' and its label control were called
"label37". I have 'discovered' that when I click in "label37" the effect is
to 'toggle' the check-box's value to the other one. I am running A2002 btw.
So, here's my question: can I have the color of the label conditioned on the
value of the check-box? At this point, 'label37' has a default white bckgrnd
and black lettering. When it's used to 'toggle' the value of the 'PCA_L' from
"Yes" to "No", I would like 'label37' bckgrnd to go to red and the lettering
to go to yellow. When it's used to 'toggle' 'PCA_L' back to "Yes", I would
like the colors of 'label37' to return to black lettering on white bckgrnd.

Is that a doable thing?
Klatuu - 12 Mar 2008 20:19 GMT
Use the After Update event of the check box:

   If Me.MyCheckBox = True Then
       Me.Label37.BackColor =
       Me.Label37ForeColor =
   Else
       Me.Label37.BackColor =
       Me.Label37ForeColor =
   End If
Signature

Dave Hargis, Microsoft Access MVP

> In developing this form, I created a bunch of check-boxes with "Yes" as their
> defaults. Let's say one is called 'PCA_L' and its label control were called
[quoted text clipped - 8 lines]
>
> Is that a doable thing?
Ron2006 - 12 Mar 2008 20:40 GMT
If the checkbox is stored in the table so that it is already set when
you are looking at the form, then you will want the above code ALSO in
the OnCurrent event of the form.
monma01 - 12 Mar 2008 21:34 GMT
>If the checkbox is stored in the table so that it is already set when
>you are looking at the form, then you will want the above code ALSO in
>the OnCurrent event of the form.

Or if you don't want to duplicate lots of code and have to edit it in
multiple places, such as if you wanted to change what the colors should be
changed to, just add a call to the update event in the form's current event:

Private Sub Form_Current()
 MyCheckBox__AfterUpdate
End Sub
Klatuu - 12 Mar 2008 21:35 GMT
Good point, Ron
Signature

Dave Hargis, Microsoft Access MVP

> If the checkbox is stored in the table so that it is already set when
> you are looking at the form, then you will want the above code ALSO in
> the OnCurrent event of the form.
 
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



©2008 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.