A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Conditional formatting of a subform's background color



 
 
Thread Tools Display Modes
  #1  
Old May 12th, 2008, 10:35 PM posted to microsoft.public.access.forms
Nicholas Scarpinato
external usenet poster
 
Posts: 114
Default Conditional formatting of a subform's background color

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!
  #2  
Old May 12th, 2008, 11:11 PM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Conditional formatting of a subform's background color

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
--
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."

"Nicholas Scarpinato" wrote
in message ...
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!



  #3  
Old May 12th, 2008, 11:37 PM posted to microsoft.public.access.forms
Nicholas Scarpinato
external usenet poster
 
Posts: 114
Default Conditional formatting of a subform's background color

That's an interesting way to do it... I'll try that. Thanks!

"Al Campagna" wrote:

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
--
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."

"Nicholas Scarpinato" wrote
in message ...
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!




  #4  
Old May 13th, 2008, 05:13 AM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Conditional formatting of a subform's background color

Let me know how you make out...

"Nicholas Scarpinato" wrote
in message ...
That's an interesting way to do it... I'll try that. Thanks!

"Al Campagna" wrote:

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
--
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."

"Nicholas Scarpinato"
wrote
in message ...
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!






  #5  
Old May 13th, 2008, 05:14 AM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Conditional formatting of a subform's background color

It's not fancy, but should do the trick...
Let me know how you make out.
--
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."

"Nicholas Scarpinato" wrote
in message ...
That's an interesting way to do it... I'll try that. Thanks!

"Al Campagna" wrote:

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
--
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."

"Nicholas Scarpinato"
wrote
in message ...
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!






 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.