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

Conditional formatting of detail section in an access form

50 views
Skip to first unread message

PBradac

unread,
Jan 21, 2010, 7:05:19 AM1/21/10
to
I'm stuck in the following problem:

- Access 2003
- Form in datasheet view (tabular form)
- Want to format (change the background color of) details section
based on a value of a text box contained in it using VBA
- Can't find where to put a statement like:
Me.Section(acDetail).Backcolor = vbWhite
so that the background would be colored correspondingly.
The coloration appears only when the condition is met on the first
record (row) shown and it spreads over all records (rows)

I want to have the right color in those rows only where the condition
is met.

TIA for help

Tom van Stiphout

unread,
Jan 21, 2010, 8:39:29 AM1/21/10
to
On Thu, 21 Jan 2010 13:05:19 +0100, PBradac
<primoz...@bfro.uni-lj.si> wrote:

Check out "Conditional Formatting" in the Help file.

-Tom.
Microsoft Access MVP

PBradac

unread,
Jan 21, 2010, 9:11:15 AM1/21/10
to
Hello Tom and thanks for your answer.

I've tried Help before but I couldn't find the answer.
In Help it's all about changing the formatting properties *of the
control based on its value*.

What I want is to change a formatting property of the whole details
section where the control is (based on the control's value of course).
E.g. if a text box shows a negative value I want the whole detail
section to show in red not just the text in the textbox.

It's simple to change the color of the details section in VBA, but
where do I have to put

Me.Section(acDetail).Backcolor = vbRed

so that it will be "executed" for the row where the textbox with
negative value is situated.

Primoz

--- news://freenews.netfront.net/ - complaints: ne...@netfront.net ---

Tom van Stiphout

unread,
Jan 21, 2010, 9:20:35 AM1/21/10
to
On Thu, 21 Jan 2010 15:11:15 +0100, PBradac
<primoz...@bfro.uni-lj.si> wrote:

I see the dilemma now. You can set conditional formatting to controls,
not to the Details section itself. Perhaps that suffices though.

-Tom.
Microsoft Access MVP

PBradac

unread,
Jan 21, 2010, 9:32:47 AM1/21/10
to
Tom,

not very happy :-(, but thanks anyway :-).

I was wondering if moving the focus through the records (and by it
through rows in datasheet) could somehow help. I'll give it a try.

Regards,
Primoz


On Thu, 21 Jan 2010 07:20:35 -0700, Tom van Stiphout

0 new messages