473,480 Members | 5,031 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Conditional Formatting Not Working

I have many text fields with conditional formatting applied,
specifically when the condition is "Field Has Focus". Without any
events associated with the fields the conditional formatting works
perfectly. However, I have code that runs under the ON CLICK event. The
code changes the focus to other controls, which means the conditional
formatting is no longer displayed. This part makes sense to me.

Here's what doesn't make sense. The last line of code re-establishes
the focus to the text field with a SetFocus command (i.e.
txtMyField.SetFocus). The field definitely has the focus, but the
conditional formatting (Field Has Focus) is not working. It doesn't
seem to apply the conditional formatting even though the field once
again has focus.

HELP!

Thanks in advance.

Oct 26 '06 #1
8 8453
On 26 Oct 2006 14:56:13 -0700, "Typehigh" <nm******@usatoday.com>
wrote:

That's probably by design.
Just like when I programmatically change the value of a control, its
Change event does not fire. But when I manually type a new value, it
does.

-Tom.

>I have many text fields with conditional formatting applied,
specifically when the condition is "Field Has Focus". Without any
events associated with the fields the conditional formatting works
perfectly. However, I have code that runs under the ON CLICK event. The
code changes the focus to other controls, which means the conditional
formatting is no longer displayed. This part makes sense to me.

Here's what doesn't make sense. The last line of code re-establishes
the focus to the text field with a SetFocus command (i.e.
txtMyField.SetFocus). The field definitely has the focus, but the
conditional formatting (Field Has Focus) is not working. It doesn't
seem to apply the conditional formatting even though the field once
again has focus.

HELP!

Thanks in advance.
Oct 27 '06 #2
Tom,

Okay, I accept your assessment of why programmatic changes don't
trigger conditions or events, but can anyone think of a way to "trick"
the application with vba so that conditional formatting will once again
apply itself to the field.
This is an essential element to my application.

Thanks to all of you for taking the time to help each other out.

Neil

Tom van Stiphout wrote:
On 26 Oct 2006 14:56:13 -0700, "Typehigh" <nm******@usatoday.com>
wrote:

That's probably by design.
Just like when I programmatically change the value of a control, its
Change event does not fire. But when I manually type a new value, it
does.

-Tom.

I have many text fields with conditional formatting applied,
specifically when the condition is "Field Has Focus". Without any
events associated with the fields the conditional formatting works
perfectly. However, I have code that runs under the ON CLICK event. The
code changes the focus to other controls, which means the conditional
formatting is no longer displayed. This part makes sense to me.

Here's what doesn't make sense. The last line of code re-establishes
the focus to the text field with a SetFocus command (i.e.
txtMyField.SetFocus). The field definitely has the focus, but the
conditional formatting (Field Has Focus) is not working. It doesn't
seem to apply the conditional formatting even though the field once
again has focus.

HELP!

Thanks in advance.
Oct 27 '06 #3
"Typehigh" <nm******@usatoday.comwrote in news:1161899772.985857.299050
@f16g2000cwb.googlegroups.com:
I have many text fields with conditional formatting applied,
specifically when the condition is "Field Has Focus". Without any
events associated with the fields the conditional formatting works
perfectly. However, I have code that runs under the ON CLICK event. The
code changes the focus to other controls, which means the conditional
formatting is no longer displayed. This part makes sense to me.

Here's what doesn't make sense. The last line of code re-establishes
the focus to the text field with a SetFocus command (i.e.
txtMyField.SetFocus). The field definitely has the focus, but the
conditional formatting (Field Has Focus) is not working. It doesn't
seem to apply the conditional formatting even though the field once
again has focus.
What you are describing works for me in Access 2003, that is the
conditional formatting is applied to Text0 (sets backcolor to red) and
Text2 (sets backcolor to blue) when Command4 and Command5 respectively
are clicked.

Private Sub Command4_Click()
Text0.SetFocus
End Sub

Private Sub Command5_Click()
Me.Text2.SetFocus
End Sub

Perhaps you are using a previous version?
or
Perhaps there is something else in your code that prevents the
conditional formatting being applied; in that case you might examine and
test your code or if that fails, post the whole thing here;
or
Perhaps I don't understand.

--
Lyle Fairfield
Oct 27 '06 #4
Lyle,

I just tried it using Access 2003 and had the same results: it's not
working for me.

I just created another db (to recreate my problem) and tried to get the
Conditional Formatting to fail and I couldn't make it happen.

I do have continuous subforms, but even when I jumped all around from
form to form and control to control, I couldn't make the Conditional
Formatting fail like on my current application.

I give up.

Neil
Lyle Fairfield wrote:
"Typehigh" <nm******@usatoday.comwrote in news:1161899772.985857.299050
@f16g2000cwb.googlegroups.com:
I have many text fields with conditional formatting applied,
specifically when the condition is "Field Has Focus". Without any
events associated with the fields the conditional formatting works
perfectly. However, I have code that runs under the ON CLICK event. The
code changes the focus to other controls, which means the conditional
formatting is no longer displayed. This part makes sense to me.

Here's what doesn't make sense. The last line of code re-establishes
the focus to the text field with a SetFocus command (i.e.
txtMyField.SetFocus). The field definitely has the focus, but the
conditional formatting (Field Has Focus) is not working. It doesn't
seem to apply the conditional formatting even though the field once
again has focus.

What you are describing works for me in Access 2003, that is the
conditional formatting is applied to Text0 (sets backcolor to red) and
Text2 (sets backcolor to blue) when Command4 and Command5 respectively
are clicked.

Private Sub Command4_Click()
Text0.SetFocus
End Sub

Private Sub Command5_Click()
Me.Text2.SetFocus
End Sub

Perhaps you are using a previous version?
or
Perhaps there is something else in your code that prevents the
conditional formatting being applied; in that case you might examine and
test your code or if that fails, post the whole thing here;
or
Perhaps I don't understand.

--
Lyle Fairfield
Oct 27 '06 #5
"Typehigh" <nm******@usatoday.comwrote in
news:11*********************@i3g2000cwc.googlegrou ps.com:
Lyle,

I just tried it using Access 2003 and had the same results: it's not
working for me.

I just created another db (to recreate my problem) and tried to get
the Conditional Formatting to fail and I couldn't make it happen.

I do have continuous subforms, but even when I jumped all around from
form to form and control to control, I couldn't make the Conditional
Formatting fail like on my current application.

I give up.
Giving up is hard to do ... didn't someone write a song about that?
Regardless it doesn't fit with my style ....

Have you done all the obvious things with your current app?
compact and repair

I'm sure you want to do the simple things before you give up ...

and maybe some not so simple
decompile/compile
(rather than giving up)

saveastext the problem form and then loadfromtext
saveastext 6, "", "newdb.mdb" and then importing all forms and reports
and modules and macros into newdb.mdb?
posting all the code behind the problem form?

and after that ... is the app too big or too secret to zip and share?

Did I mention that I HATE "give up"!

--
Lyle Fairfield
Oct 27 '06 #6

"Lyle Fairfield" <ly***********@aim.comschreef in bericht news:Xn*********************************@216.221.8 1.119...
"Typehigh" <nm******@usatoday.comwrote in
news:11*********************@i3g2000cwc.googlegrou ps.com:
>Lyle,

I just tried it using Access 2003 and had the same results: it's not
working for me.

I just created another db (to recreate my problem) and tried to get
the Conditional Formatting to fail and I couldn't make it happen.

I do have continuous subforms, but even when I jumped all around from
form to form and control to control, I couldn't make the Conditional
Formatting fail like on my current application.

I give up.
Giving up is hard to do ... didn't someone write a song about that?
Regardless it doesn't fit with my style ....
Like:
"A quitter never wins
A winner never quits.
When the going get's tough
The tough get going."
(Randy Newman - Memo to my Son)

Arno R

Oct 27 '06 #7
By the time I post something, I've pretty much tried everything.
Compact and Repair, new db with imported code, everything (but the
solution).
I finally figured out a workaround. I believe the problem stems from
multiple nested routines and something way down deep is killing the
focus. Here's what I did.

Created a button control on my form called cmdResetFocus.
I turned off it's visibility (cmdResetFocus.Visible = False)
Removed all of the Set Focus commands from my nests.
Before calling the subroutines. I set the focus to the cmdResetFocus.
Run the routines.
After the routines are run, I shift the focus to the actual desired
field.
Works like a charm.

Now if someone could only solve this problem I would be golden.

http://groups.google.com/group/comp....0f92512946a461


Lyle Fairfield wrote:
"Typehigh" <nm******@usatoday.comwrote in
news:11*********************@i3g2000cwc.googlegrou ps.com:
Lyle,

I just tried it using Access 2003 and had the same results: it's not
working for me.

I just created another db (to recreate my problem) and tried to get
the Conditional Formatting to fail and I couldn't make it happen.

I do have continuous subforms, but even when I jumped all around from
form to form and control to control, I couldn't make the Conditional
Formatting fail like on my current application.

I give up.

Giving up is hard to do ... didn't someone write a song about that?
Regardless it doesn't fit with my style ....

Have you done all the obvious things with your current app?
compact and repair

I'm sure you want to do the simple things before you give up ...

and maybe some not so simple
decompile/compile
(rather than giving up)

saveastext the problem form and then loadfromtext
saveastext 6, "", "newdb.mdb" and then importing all forms and reports
and modules and macros into newdb.mdb?
posting all the code behind the problem form?

and after that ... is the app too big or too secret to zip and share?

Did I mention that I HATE "give up"!

--
Lyle Fairfield
Oct 27 '06 #8
You need to use Me.Recalc to force conditional formatting.

--
Darryl Kerkeslager
Oct 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5912
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
4
3112
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the...
5
2340
by: John Baker | last post by:
Hi: I have a field that i wish to use the conditional format capability on, and for some reason it wont work. The field is a a text box: =- I would like to make it red when negative, and...
3
2285
by: Chuck Reed | last post by:
I am working on a sales report where I show weekly sales by category for each of the 52 weeks in the year. Each record in my table/report has the 52 weeks of sales in it. I want to highlight to top...
1
4941
by: GGerard | last post by:
Hello Is there a way to use a variable in the Conditional Formatting of a Textbox? Example : I want the background of a textbox in a continuous form to change color when the value of...
2
2331
by: jodyblau | last post by:
I'm not certain that what I am trying to do is possible; in any event I haven't been able to figure it out. Here is what I am trying to do: I have one table that has a list of cases I'm working...
7
2068
by: Andy_Khosravi | last post by:
I use the formatting trick in A97 to simulate conditional formatting in continuous forms. It has, up to this point, worked fine. Today I was making some design changes to the parent form (the...
1
2478
by: Earl Anderson | last post by:
A business colleague and I are collaborating 'long distance' on an applet for work. He is doing the programming and I am doing the business process form design. We had discussed my desire to make...
1
2539
by: Greg (codepug | last post by:
Access 2000 Using a textbox of a single form, I created a calculated field. The following code is in the Control Source for this field: =IIf(=24,+(/),/ ) The numbers that are calculated are...
0
7039
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6895
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1296
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.