Conditional Formatting - all fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I looked at the earlier messages under this subject but couldn't find
exactly what I was looking for. I have a bit of a different question. Does
anybody know of a way to change the font in all of the text boxes on a single
form based on the value of one of the text boxes? Is this even possible? An
example would be a full customer profile where the font would change color
depending on say the value of sales. The result being that identified
customers would appear in red font as opposed to the default black. There
doesn't seem to be a way to use the conditional formatting from the menu vary
the entire form or the details section or to change the format of one field
based on another field.

Any suggestions would be very much appreciated.
Thank you.
 
if you use the Expression Is option in the Conditional Formatting dialog,
and set the expression to, for example,

[ControlName] > 1000

then the chosen format will be applied when that control has a value greater
than 1000. but AFAIK, there is no way to change all the controls on the form
except by adding the format instructions to each control individually.

if your form is SingleForm view, rather than ContinuousForms or Datasheet,
then alternatively you can use VBA to loop through the controls and change
the formatting. you'd want to call the code on the control's AfterUpdate
event, and also on the form's Current event.

hth
 
Hi Tina,

Thank you for your quick response and yes, the form is a single form. You
mention that this can be done in VBA. Not knowing VBA, could you give an
sample of the code required.

Again, thank you
 
If it does not matter that all the controls look the same (e.g. same font,
font size), you can follow Tina's instructions to set the conditional
formatting for one control and then use the format Painter button (looks like
a panitbrush) to copy the conditional formatting to other controls. you do
this by highlighting the control with the conditional formating press the
button and then select the control you want to change, it will still take
time but is faster than changing conditional formatting for each control

Phil

tina said:
if you use the Expression Is option in the Conditional Formatting dialog,
and set the expression to, for example,

[ControlName] > 1000

then the chosen format will be applied when that control has a value greater
than 1000. but AFAIK, there is no way to change all the controls on the form
except by adding the format instructions to each control individually.

if your form is SingleForm view, rather than ContinuousForms or Datasheet,
then alternatively you can use VBA to loop through the controls and change
the formatting. you'd want to call the code on the control's AfterUpdate
event, and also on the form's Current event.

hth


Drowning in VB code said:
Hi,
I looked at the earlier messages under this subject but couldn't find
exactly what I was looking for. I have a bit of a different question. Does
anybody know of a way to change the font in all of the text boxes on a single
form based on the value of one of the text boxes? Is this even possible? An
example would be a full customer profile where the font would change color
depending on say the value of sales. The result being that identified
customers would appear in red font as opposed to the default black. There
doesn't seem to be a way to use the conditional formatting from the menu vary
the entire form or the details section or to change the format of one field
based on another field.

Any suggestions would be very much appreciated.
Thank you.
 
Hi Phil,

I rechecked to be sure and, unfortunately, the Format Painter does not copy
over conditional formatting from one field to another - at least not in
Access 2000. It would have been simple. Thank you for the suggestion just
the same.
 
Are you sure, I checked yesterday before I posted as I was not sure, but I
have checked again this morning by adding a control to a subform and using
the format painter and it copied over the conditional formatting, I am using
A2000.

One thing I have just thought of, when you use the format painter you need
to copy from a control where the conditional formatting is in the format of
"Expression is" option (as per Tina's Post) not the "Field Value is" as this
will not work

just a thought

Phil
 
i'm late getting back to this thread, sorry. if you would still like a code
example, post back, and i'll put one together this weekend and post it (
unless somebody else does it first).

hth
 
Back
Top