How to set color of field?

W

WDSnews

In ObjectPal I used the 'Arrive' event to set the color of a field or a
record in a child table. This allowed the color to vary from one record to
the next in a datasheet view.

In Access, the 'On Current' event only works in form view. It doesn't work
in datasheet view. The 'Format' event is only available in Report objects.
The 'Conditional' format only allows three alternatives.

How can Access vary colors from one record to the next in a datasheet, or
datasheet-like view?
 
D

Dirk Goldgar

WDSnews said:
In ObjectPal I used the 'Arrive' event to set the color of a field or a
record in a child table. This allowed the color to vary from one record
to the next in a datasheet view.

In Access, the 'On Current' event only works in form view. It doesn't
work in datasheet view. The 'Format' event is only available in Report
objects. The 'Conditional' format only allows three alternatives.

How can Access vary colors from one record to the next in a datasheet, or
datasheet-like view?


Use a Continuous Form, and make it look as much like a datasheet view as you
like. Then you can use conditional formatting, but if that's too limited
for you, it could end up being hard to do what you want.
 
W

WDSnews

well, that's why I mentioned the three alternative limit of "conditional
formatting". It won't work for what I need.

It's ok if it "ends up being hard" to do what I want... so long as there's a
way. Can you point me in a direction that might be possible to format or
color each record differently in a datasheet-like view?
 
D

Dirk Goldgar

WDSnews said:
well, that's why I mentioned the three alternative limit of "conditional
formatting". It won't work for what I need.

It's ok if it "ends up being hard" to do what I want... so long as there's
a way. Can you point me in a direction that might be possible to format
or color each record differently in a datasheet-like view?


Do you want to color records, or specific controls in those records?

One way to do this sort of thing without using conditional formatting is to
put a set of calculated text boxes, disabled and locked, behind the controls
in the detail section. Each of these text boxes, which I'll refer to as the
"highlighting" text boxes, would have these properties:

Back Style: Transparent
Font Name: Terminal
Font Size: (big enough to completely fill the height of the text box)
Fore Color: (your chosen highlighting color)
Control Source:
=IIf(<your condition for highlighting>, String(255,219),Null)

All of the highlighting text boxes would be sent to the back; they may
be -- normally would be -- all on top of each other. Each one has its
controlsource set to evaluate a distinct condition and return a
textbox-filling string if that conditon is true. You can have as many of
these highlighting text boxes as you have distinct conditions requiring
different highlighting. You may choose to make each one big enough to
completely cover the detail section, so that the whole section appears a
different color for each record.

You may choose to have the other controls on the form's detail section have
a transparent back style, in which case the highlighting color will show
through for all except the control that has the focus. Or you may choose to
have a normal back style for those controls, in which case only the
background of the detail section will show the color.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top