backcolor

A

Andy

I have converted an A97 report to A2k. Each textbox in the report's
detail section calls a function to check the value of the textbox, and
depending on the value, change the background color accordingly.

Value Color
< -20 red
between -20 & -10 yellow
between -10 & -1 green

The problem is the back ground color gets changed for the next display
of the widget, not the current display.

The function performing the evaluation accepts the data value and the
textbox control Id as parameters:

function getCellColor(Value as string, Widget as textbox) as string

textbox1 control property is set to: =getCellColor([V1], [text1])
textbox2 control property is set to: =getCellColor([V2], [text2]). etc


The backcolor is set using widget.backcolor = long(appropriate value for
desired color). The function also returns a string for display in the
textbox.

All returned strings are displayed in the correct textbox. All
background colors are displayed in the next occurence of the textbox
(next line) of the report.

How can I change the back ground color of the current widget?


Andy
 
J

Jeff Boyce

Andy

You didn't mention WHERE the code is doing this. Are you using the OnFormat
event?

More info, please...

Jeff Boyce
<Access MVP>

Andy said:
I have converted an A97 report to A2k. Each textbox in the report's
detail section calls a function to check the value of the textbox, and
depending on the value, change the background color accordingly.

Value Color
< -20 red
between -20 & -10 yellow
between -10 & -1 green

The problem is the back ground color gets changed for the next display
of the widget, not the current display.

The function performing the evaluation accepts the data value and the
textbox control Id as parameters:

function getCellColor(Value as string, Widget as textbox) as string

textbox1 control property is set to: =getCellColor([V1], [text1])
textbox2 control property is set to: =getCellColor([V2], [text2]). etc


The backcolor is set using widget.backcolor = long(appropriate value for
desired color). The function also returns a string for display in the
textbox.

All returned strings are displayed in the correct textbox. All
background colors are displayed in the next occurence of the textbox
(next line) of the report.

How can I change the back ground color of the current widget?


Andy
 
A

Andy

Not using the OnFormat event.

The textbox is in the detail section of a report. I don't see any events
associated with it.

The control source of the textbox is set to =getCellColor.

Jeff said:
Andy

You didn't mention WHERE the code is doing this. Are you using the OnFormat
event?

More info, please...

Jeff Boyce
<Access MVP>

I have converted an A97 report to A2k. Each textbox in the report's
detail section calls a function to check the value of the textbox, and
depending on the value, change the background color accordingly.

Value Color
< -20 red
between -20 & -10 yellow
between -10 & -1 green

The problem is the back ground color gets changed for the next display
of the widget, not the current display.

The function performing the evaluation accepts the data value and the
textbox control Id as parameters:

function getCellColor(Value as string, Widget as textbox) as string

textbox1 control property is set to: =getCellColor([V1], [text1])
textbox2 control property is set to: =getCellColor([V2], [text2]). etc


The backcolor is set using widget.backcolor = long(appropriate value for
desired color). The function also returns a string for display in the
textbox.

All returned strings are displayed in the correct textbox. All
background colors are displayed in the next occurence of the textbox
(next line) of the report.

How can I change the back ground color of the current widget?


Andy
 
J

Jeff Boyce

Andy

In design view, click on the "Detail" section header. Click on the
Properties toolbar button. Select the OnFormat event and add your code
setting backcolor to an event procedure that runs each time the detail
section formats a row (i.e., OnFormat).

Good luck

Jeff Boyce
<Access MVP>

Andy said:
Not using the OnFormat event.

The textbox is in the detail section of a report. I don't see any events
associated with it.

The control source of the textbox is set to =getCellColor.

Jeff said:
Andy

You didn't mention WHERE the code is doing this. Are you using the OnFormat
event?

More info, please...

Jeff Boyce
<Access MVP>

I have converted an A97 report to A2k. Each textbox in the report's
detail section calls a function to check the value of the textbox, and
depending on the value, change the background color accordingly.

Value Color
< -20 red
between -20 & -10 yellow
between -10 & -1 green
-1 gray

The problem is the back ground color gets changed for the next display
of the widget, not the current display.

The function performing the evaluation accepts the data value and the
textbox control Id as parameters:

function getCellColor(Value as string, Widget as textbox) as string

textbox1 control property is set to: =getCellColor([V1], [text1])
textbox2 control property is set to: =getCellColor([V2], [text2]). etc


The backcolor is set using widget.backcolor = long(appropriate value for
desired color). The function also returns a string for display in the
textbox.

All returned strings are displayed in the correct textbox. All
background colors are displayed in the next occurence of the textbox
(next line) of the report.

How can I change the back ground color of the current widget?


Andy
 
A

Andy

Thanks for the tip.

I have it working now.

Andy

Jeff said:
Andy

In design view, click on the "Detail" section header. Click on the
Properties toolbar button. Select the OnFormat event and add your code
setting backcolor to an event procedure that runs each time the detail
section formats a row (i.e., OnFormat).

Good luck

Jeff Boyce
<Access MVP>

Not using the OnFormat event.

The textbox is in the detail section of a report. I don't see any events
associated with it.

The control source of the textbox is set to =getCellColor.

Jeff said:
Andy

You didn't mention WHERE the code is doing this. Are you using the
OnFormat
event?

More info, please...

Jeff Boyce
<Access MVP>



I have converted an A97 report to A2k. Each textbox in the report's
detail section calls a function to check the value of the textbox, and
depending on the value, change the background color accordingly.

Value Color
< -20 red
between -20 & -10 yellow
between -10 & -1 green

-1 gray

The problem is the back ground color gets changed for the next display
of the widget, not the current display.

The function performing the evaluation accepts the data value and the
textbox control Id as parameters:

function getCellColor(Value as string, Widget as textbox) as string

textbox1 control property is set to: =getCellColor([V1], [text1])
textbox2 control property is set to: =getCellColor([V2], [text2]). etc


The backcolor is set using widget.backcolor = long(appropriate value for
desired color). The function also returns a string for display in the
textbox.

All returned strings are displayed in the correct textbox. All
background colors are displayed in the next occurence of the textbox
(next line) of the report.

How can I change the back ground color of the current widget?


Andy
 

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