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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Continous Forms Code Question 2

Status
Not open for further replies.

iXPhound

Technical User
Feb 25, 2001
146
US
Ok...I have a continuous form, if I wanted to do something like:
If TxtBox.text = "a" Then
TxtBox.ForeColor = 255
Elseif TxtBox.text = "b" Then
TxtBox.ForeColor = 128
Elseif TxtBox.text = "c" Then
TxtBox.ForeColor = 0
Else
TxtBox.ForeColor = 233
End If

What I am looking for is to have it look through each record and change the forecolor depending on the value of TxtBox. What happens now is that if I use this...it changes the color of all the TxtBox.Text. I just want it to go through and change the colors of the Boxes if they meet the criteria of a b or c. I am a beginner, can anyone help? TIA!!!

 
Probably the easiest way for the newbie (in A2K) is to use the conditional formatting on the “Formatting” menu. You can set up to three (plus the default for four total) formats based upon the record conditions. In your example above you’d…

1) Select your control you want to conditionally format in design mode.
2) Go to “Conditional Formatting…” on the “Format” menu.
3) Select “field value is…” option
4) Select “equal to”
5) Then select “a”
6) Set up foreground & BG colors etc.

For other controls:
1) & 2) the same
3) Select “expression is”
4) Then enter the something like below as the expression
[fieldThatFeedsTxtBox] = “a”
5) Set up foreground & BG colors etc.

Play around with it some to get things looking the way you want.

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top