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 / May 2008

Tip: Looking for answers? Try searching our database.

Conditional formatting of a subform's background color

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nicholas Scarpinato - 12 May 2008 22:35 GMT
I've read about 50 examples of how to use Conditional Formatting to change
the color of specific fields in a continuous form. Is there a way to use it
to change the form's background color for that particular record, while
leaving the records that are have not met the condition in their normal
format? What I'm attempting to do is build a form that shows all of the users
who are out on break, with their "Out" time and their "Due In" time. I want
to display the users who have not passed their "Due In" with a green
background, and the ones who have passed that time with a red background. I
can get one or the other, but it all depends on the first record in the form.
If the first record in the form meets the "lapsed" criteria, the entire
subform displays with the red background, and vice versa. Can this be done
with a continuous form, or do I need to look into another way to attempt this?

Here is my code... part of my problem is I'm not real sure where to put this
code so that it runs on every record, or if I've even got it written
correctly:

If DateDiff("m", Me!DueTime, Now()) > 15 Then
PastClockTime = 1
Else
PastClockTime = 2
End If
Select Case PastClockTime
Case 1
Me.Detail.BackColor = 1643706
Me.Label1.ForeColor = 16777215
Me.Label3.ForeColor = 16777215
Me.Label5.ForeColor = 16777215
Me.Label7.ForeColor = 16777215
Case 2
Me.Detail.BackColor = 16777215
Me.Label1.ForeColor = 0
Me.Label3.ForeColor = 0
Me.Label5.ForeColor = 0
Me.Label7.ForeColor = 0
End Select

Any help is much appreciated. Thanks!
Al Campagna - 12 May 2008 23:11 GMT
Nicholas,
   If you can make your subform controls transparent, you can use an
unbound text control behind your fields, and apply ConditionalFormatting to
that.
   Make the "background" text contol as high and as wide as your subform
detail record.
   Cond/Formatting that background control will make the backgrounds of all
your transparent fields "appear" to correctly colored.
   Condition1
       Expression Is [PastClockTime] = 1
   Condition2
       Expression Is [PastClockTime] = 2
hth
Signature

   hth
   Al Campagna
   Microsoft Access MVP
   http://home.comcast.net/~cccsolutions/index.html

   "Find a job that you love... and you'll never work a day in your life."

> I've read about 50 examples of how to use Conditional Formatting to change
> the color of specific fields in a continuous form. Is there a way to use
[quoted text clipped - 41 lines]
>
> Any help is much appreciated. Thanks!
Nicholas Scarpinato - 12 May 2008 23:37 GMT
That's an interesting way to do it... I'll try that. Thanks!

> Nicholas,
>     If you can make your subform controls transparent, you can use an
[quoted text clipped - 54 lines]
> >
> > Any help is much appreciated. Thanks!
Al Campagna - 13 May 2008 05:13 GMT
Let me know how you make out...

> That's an interesting way to do it... I'll try that. Thanks!
>
[quoted text clipped - 63 lines]
>> >
>> > Any help is much appreciated. Thanks!
Al Campagna - 13 May 2008 05:14 GMT
It's not fancy, but should do the trick...
Let me know how you make out.
Signature

   hth
   Al Campagna
   Microsoft Access MVP
   http://home.comcast.net/~cccsolutions/index.html

   "Find a job that you love... and you'll never work a day in your life."

> That's an interesting way to do it... I'll try that. Thanks!
>
[quoted text clipped - 63 lines]
>> >
>> > Any help is much appreciated. Thanks!
 
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.