Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to set color of field?

6 views
Skip to first unread message

WDSnews

unread,
Apr 21, 2010, 8:10:29 PM4/21/10
to
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?


Dirk Goldgar

unread,
Apr 22, 2010, 4:15:49 PM4/22/10
to
"WDSnews" <wdsnew...@oregoncity.com> wrote in message
news:eKrd4Ab4...@TK2MSFTNGP05.phx.gbl...


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.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

WDSnews

unread,
Apr 22, 2010, 7:48:41 PM4/22/10
to
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?


"Dirk Goldgar" <d...@NOdataSPAMgnostics.com.invalid> wrote in message
news:DCB802FC-F6B2-4708...@microsoft.com...

Peter Hibbs

unread,
Apr 23, 2010, 4:05:54 AM4/23/10
to
WDSnews,

You could do this by using a Flex Grid control instead of a Continuous
form. Have a look at my Flex Grid Demo program at :-

http://www.rogersaccesslibrary.com/forum/forum_topics.asp?FID=21&SID=5debzz2c87c6957859f13b1d2zcccfb4

for some examples, (you will need to write a bit of VBA code though).

Peter Hibbs.

Dirk Goldgar

unread,
Apr 23, 2010, 11:49:40 AM4/23/10
to
"WDSnews" <wdsnew...@oregoncity.com> wrote in message
news:eWmLXZn4...@TK2MSFTNGP04.phx.gbl...

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

0 new messages