How to set backcolour

R

Ruth Isaacs

Hello All

I have a continuous form containing a number field (long integer) called
[v_colour]. This field contains the number of a certain colour - as per the
numbers that are used in the format properties for back colour etc. I would
like to set the back colour for the form's [v_colour] text box to be the
value of the field:
e.g.
If the value of [v_colour] in the first record is 255, I want the back
colour of the textbox for that record to be bright red.

I tried this as the OnLoad event for the form:

[v_colour].backcolour = [v_colour].value

.... but this resulted in the back colour of the textbox in EVERY record
being set to the value of [v_colour] in the first record - i.e. [v_colour]
had the same back colour for every record, even though the value of
[v_colour] was different for every record.

I'm sure this can be done - but can't seem to get it!

Hope someone can help.

Many thanks
Les
 
S

Scott McDaniel

Hello All

I have a continuous form containing a number field (long integer) called
[v_colour]. This field contains the number of a certain colour - as per the
numbers that are used in the format properties for back colour etc. I would
like to set the back colour for the form's [v_colour] text box to be the
value of the field:
e.g.
If the value of [v_colour] in the first record is 255, I want the back
colour of the textbox for that record to be bright red.

I tried this as the OnLoad event for the form:

[v_colour].backcolour = [v_colour].value

... but this resulted in the back colour of the textbox in EVERY record
being set to the value of [v_colour] in the first record - i.e. [v_colour]
had the same back colour for every record, even though the value of
[v_colour] was different for every record.

Continuous forms basically have one active group of controls, and the rest are just painted on the screen (for lack of a
better description), which is why ALL of your controls change when your code fires. You can try moving this code to the
Current event of the form, but it still may not work correctly.

You can try using Conditional Formatting to do this, but you're limited to 3 conditions (actually 4 if you consider the
Default condition as one). You might be able to use the "Expression Is" feature to get this to work somewhat, but I
doubt it'll do what you're looking for.

Stephan Lebans has a sample dealing with a similar issue on his site: http://www.lebans.com/conditionalformatting.htm.
This deals with a listbox, but perhaps you'd be able to modify this to work with your project.

I'm sure this can be done - but can't seem to get it!

Hope someone can help.

Many thanks
Les

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 

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