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  

Conditinal Format Not Working



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2010, 10:54 PM posted to microsoft.public.access.forms
Dee
external usenet poster
 
Posts: 644
Default Conditinal Format Not Working

I am trying to get a field to turn red if the condition is "High"
I tried using the conditional formatting and it does not work. I also tried
using the below vba code and this does not work either. I tried it in the
after update procedure and the on current procedure with no luck. Could this
be an Access bug?

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
End If
End Sub
  #2  
Old May 19th, 2010, 12:12 AM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Conditinal Format Not Working

Dee,
Is Critical a manually entered text control? Or a Combo... or a List?
Is it bound to a text field? Details please...
Your code, although faulty (so far), should have (at least) turned
Critical to red
after an update with "High" See below for further tweaking of that code...
Also, what version of Access are you using... and if 2000 or greater...
have
you tried Conditional Formatting?
------------------
You'll also need to indicate what color you want Critical, if it's not
"High."
Otherwise, once you've turned Critical red, and go to another record... that
value will be red too... regardless whether it's "High" or not.

And... you'll also need to have that same code in the OnCurrent event of
the form, so that when you arrive at a record with Critical = "High", the
text
is made red. And if not, the text would be made black.

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
Else
Me.Critical.ForeColor = vbBlack
End If
End Sub

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

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


"Dee" wrote in message
...
I am trying to get a field to turn red if the condition is "High"
I tried using the conditional formatting and it does not work. I also
tried
using the below vba code and this does not work either. I tried it in the
after update procedure and the on current procedure with no luck. Could
this
be an Access bug?

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
End If
End Sub



  #3  
Old May 19th, 2010, 05:11 PM posted to microsoft.public.access.forms
Dee
external usenet poster
 
Posts: 644
Default Conditional Format Not Working

Yes, I tried conditional formatting first since that would be the easiest and
quickest - so I thought - but it did not work. So then I tried the vba code
and that did not work. I also tried using your code in both the combo box
after update event and the forms on current event. Nothing happens. I dont
get any errors.(critical is the como box - in a single form). I am using
Access version 2007.

I tested the conditional formatting using "field has focus" and that works -
but not the "expression is"

"Al Campagna" wrote:

Dee,
Is Critical a manually entered text control? Or a Combo... or a List?
Is it bound to a text field? Details please...
Your code, although faulty (so far), should have (at least) turned
Critical to red
after an update with "High" See below for further tweaking of that code...
Also, what version of Access are you using... and if 2000 or greater...
have
you tried Conditional Formatting?
------------------
You'll also need to indicate what color you want Critical, if it's not
"High."
Otherwise, once you've turned Critical red, and go to another record... that
value will be red too... regardless whether it's "High" or not.

And... you'll also need to have that same code in the OnCurrent event of
the form, so that when you arrive at a record with Critical = "High", the
text
is made red. And if not, the text would be made black.

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
Else
Me.Critical.ForeColor = vbBlack
End If
End Sub

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

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


"Dee" wrote in message
...
I am trying to get a field to turn red if the condition is "High"
I tried using the conditional formatting and it does not work. I also
tried
using the below vba code and this does not work either. I tried it in the
after update procedure and the on current procedure with no luck. Could
this
be an Access bug?

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
End If
End Sub



.

  #4  
Old May 19th, 2010, 06:48 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default Conditional Format Not Working

What did your expression look like in Conditional Formatting? The correct
syntax should be

[Critical] = "High"

just like that, with the square brackets around the control's name. Then set
the forecolor to red. If [Critical] isn't "High" the formatting should revert
to the default, which is usually black.

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201005/1

  #5  
Old May 19th, 2010, 07:20 PM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Conditional Format Not Working

Dee,
I suspected that this was a combo box, because a text control with
"High" in it would have at least gone red after entereing "High".
Sounds like what is "displayed" in Critical is not what the real value
of Critical is.
Please describe your combo in detail... Columns, NoOfCols, ColWidths,
etc...

And try this...
If the your combo is named Critical, then place an unbound text
control on the form, and give it a ControlSource of...
= [Critical]

**When you set the value of combo Critical, what does the text control
indicate?
**Does it display "High" when "High" is selected in Critical?
**Is Critical a Lookup field in your table design?
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

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

"Dee" wrote in message
...
Yes, I tried conditional formatting first since that would be the easiest
and
quickest - so I thought - but it did not work. So then I tried the vba
code
and that did not work. I also tried using your code in both the combo box
after update event and the forms on current event. Nothing happens. I
dont
get any errors.(critical is the como box - in a single form). I am using
Access version 2007.

I tested the conditional formatting using "field has focus" and that
works -
but not the "expression is"

"Al Campagna" wrote:

Dee,
Is Critical a manually entered text control? Or a Combo... or a
List?
Is it bound to a text field? Details please...
Your code, although faulty (so far), should have (at least) turned
Critical to red
after an update with "High" See below for further tweaking of that
code...
Also, what version of Access are you using... and if 2000 or
greater...
have
you tried Conditional Formatting?
------------------
You'll also need to indicate what color you want Critical, if it's
not
"High."
Otherwise, once you've turned Critical red, and go to another record...
that
value will be red too... regardless whether it's "High" or not.

And... you'll also need to have that same code in the OnCurrent event
of
the form, so that when you arrive at a record with Critical = "High", the
text
is made red. And if not, the text would be made black.

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
Else
Me.Critical.ForeColor = vbBlack
End If
End Sub

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

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


"Dee" wrote in message
...
I am trying to get a field to turn red if the condition is "High"
I tried using the conditional formatting and it does not work. I also
tried
using the below vba code and this does not work either. I tried it in
the
after update procedure and the on current procedure with no luck.
Could
this
be an Access bug?

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
End If
End Sub



.



  #6  
Old May 20th, 2010, 02:43 PM posted to microsoft.public.access.forms
Dee
external usenet poster
 
Posts: 644
Default Conditional Format Not Working

Al,

It is a look up field, so I changed "high" to its number value and it now it
works in both the conditional format and in vba.

Thank you!

"Al Campagna" wrote:

Dee,
I suspected that this was a combo box, because a text control with
"High" in it would have at least gone red after entereing "High".
Sounds like what is "displayed" in Critical is not what the real value
of Critical is.
Please describe your combo in detail... Columns, NoOfCols, ColWidths,
etc...

And try this...
If the your combo is named Critical, then place an unbound text
control on the form, and give it a ControlSource of...
= [Critical]

**When you set the value of combo Critical, what does the text control
indicate?
**Does it display "High" when "High" is selected in Critical?
**Is Critical a Lookup field in your table design?
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

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

"Dee" wrote in message
...
Yes, I tried conditional formatting first since that would be the easiest
and
quickest - so I thought - but it did not work. So then I tried the vba
code
and that did not work. I also tried using your code in both the combo box
after update event and the forms on current event. Nothing happens. I
dont
get any errors.(critical is the como box - in a single form). I am using
Access version 2007.

I tested the conditional formatting using "field has focus" and that
works -
but not the "expression is"

"Al Campagna" wrote:

Dee,
Is Critical a manually entered text control? Or a Combo... or a
List?
Is it bound to a text field? Details please...
Your code, although faulty (so far), should have (at least) turned
Critical to red
after an update with "High" See below for further tweaking of that
code...
Also, what version of Access are you using... and if 2000 or
greater...
have
you tried Conditional Formatting?
------------------
You'll also need to indicate what color you want Critical, if it's
not
"High."
Otherwise, once you've turned Critical red, and go to another record...
that
value will be red too... regardless whether it's "High" or not.

And... you'll also need to have that same code in the OnCurrent event
of
the form, so that when you arrive at a record with Critical = "High", the
text
is made red. And if not, the text would be made black.

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
Else
Me.Critical.ForeColor = vbBlack
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

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


"Dee" wrote in message
...
I am trying to get a field to turn red if the condition is "High"
I tried using the conditional formatting and it does not work. I also
tried
using the below vba code and this does not work either. I tried it in
the
after update procedure and the on current procedure with no luck.
Could
this
be an Access bug?

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
End If
End Sub


.



.

  #7  
Old May 21st, 2010, 12:05 AM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Conditional Format Not Working

Very good! I avoid Loookup fields... just for that reason.
Too con-foosing...
Al

"Dee" wrote in message
...
Al,

It is a look up field, so I changed "high" to its number value and it now
it
works in both the conditional format and in vba.

Thank you!

"Al Campagna" wrote:

Dee,
I suspected that this was a combo box, because a text control with
"High" in it would have at least gone red after entereing "High".
Sounds like what is "displayed" in Critical is not what the real
value
of Critical is.
Please describe your combo in detail... Columns, NoOfCols, ColWidths,
etc...

And try this...
If the your combo is named Critical, then place an unbound text
control on the form, and give it a ControlSource of...
= [Critical]

**When you set the value of combo Critical, what does the text control
indicate?
**Does it display "High" when "High" is selected in Critical?
**Is Critical a Lookup field in your table design?
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

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

"Dee" wrote in message
...
Yes, I tried conditional formatting first since that would be the
easiest
and
quickest - so I thought - but it did not work. So then I tried the vba
code
and that did not work. I also tried using your code in both the combo
box
after update event and the forms on current event. Nothing happens. I
dont
get any errors.(critical is the como box - in a single form). I am
using
Access version 2007.

I tested the conditional formatting using "field has focus" and that
works -
but not the "expression is"

"Al Campagna" wrote:

Dee,
Is Critical a manually entered text control? Or a Combo... or a
List?
Is it bound to a text field? Details please...
Your code, although faulty (so far), should have (at least) turned
Critical to red
after an update with "High" See below for further tweaking of that
code...
Also, what version of Access are you using... and if 2000 or
greater...
have
you tried Conditional Formatting?
------------------
You'll also need to indicate what color you want Critical, if it's
not
"High."
Otherwise, once you've turned Critical red, and go to another
record...
that
value will be red too... regardless whether it's "High" or not.

And... you'll also need to have that same code in the OnCurrent
event
of
the form, so that when you arrive at a record with Critical = "High",
the
text
is made red. And if not, the text would be made black.

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
Else
Me.Critical.ForeColor = vbBlack
End If
End Sub
--
hth
Al Campagna
Microsoft Access MVP 2007-2009
http://home.comcast.net/~cccsolutions/index.html

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


"Dee" wrote in message
...
I am trying to get a field to turn red if the condition is "High"
I tried using the conditional formatting and it does not work. I
also
tried
using the below vba code and this does not work either. I tried it
in
the
after update procedure and the on current procedure with no luck.
Could
this
be an Access bug?

Private Sub Critical_AfterUpdate()
If Me.Critical = "High" Then
Me.Critical.ForeColor = vbRed
End If
End Sub


.



.



 




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 09:55 AM.


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