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

Changing record font color based on field value 1

Status
Not open for further replies.

TryAgainToo

Technical User
May 4, 2004
6
0
0
US
I have a tableframe on a form that displays a small portion (6 fields) of data in a table. The table itself has over 50,000 records. I would like to change the font color of the entire record (all fields)displayed in the tableframe to red if one of the fields (which is NOT displayed in the table frame) contains a particular string. How do I do this?
 
Here is a failry simple solution, attach this code to the "NewValue" event on one of the displayed fields. I use dmGet() to get the value from the non-displayed field. Set "tableName" to the name of the table in the datamodel and "Field" to the field name of the field with the value.

Code:
var
  sVal string
endvar

dmGet("tableName","Field",sVal)

if sVAl = "String" then ; replace with appropriate string
	fieldName1.font.color = red ; change the fieldName to the name of the field displayed in the table frame for all 6 fields
	fieldName2.font.color = red
	fieldName3....font.color = red
else
	fieldName1.font.color = black
	fieldName2.font.color = black
	fieldName3....font.color = black
endif

Hope this helps
Perrin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top