Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing textbox colors on continuous forms

Status
Not open for further replies.

telephoto

Technical User
Nov 3, 2002
210
0
0
GB
I have a continuous form looking at data in a table. Each record has two text boxes and two check (tick) boxes.
If one check box is True then I want the text color of that record to be red, if the other is True then the text should be yellow, and if neither are True the colour should be black (default).
Code along the lines of "If checkbox123 = True then Textbox12.forecolor = vbred" is not suitable as that changes all the textboxes in the continous form.
Does anyone have any ideas please?
Telephoto
 
in the format menu try conditional formatting Christiaan Baes
Belgium
"What a wonderfull world" - Louis armstrong
 
[tt]
Hi:

You wrote: Code along the lines of "If checkbox123 = True then Textbox12.forecolor = vbred" is not suitable as that changes all the textboxes in the continous form."

Where are you putting that code? Put it in the On Current event, and if Textbox12 is bound to an underlying field, it should behave properly...I think.

Good luck
[glasses][tt] Gus Brunston - Access2000(DAO)[/tt] Intermediate skills.
 
Gus
The code was put in the on open event. Because this is a continous form it only needs one box checked to affect all the displayed textboxes.

chrissie1
This sounds great if it works like conditional formating in Excel - but is this available in Access97?
I can't find any references to it all.

Thanks both for trying to help.
Telephoto
 
[tt]
Hi:

Sorry about that.

By the way, conditional format was introduced in Access2000. [glasses][tt] Gus Brunston - Access2000(DAO)[/tt] Intermediate skills.
 
Hi

Yes you can do it but you have to cheat. For the text box you want to change the color of create 2 (You can figure the other one once you can do this).
Name the text boxes something like txtRed and txtBlue. Make them identical and transparent but with red and blue Forecolor.

Now set the Data Source as follows:

=IIf([checkbox1]=True,"",fieldname)

Where fieldname is the data field.

Now if you place them exactly on top of each other you will see either red or blue text depending on the value of the checkbox.

For the value of the 3rd color its just a question of working out how you set the logical value.

Good luck

saltecho
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top