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

Text Coloring "Urgent"

Status
Not open for further replies.

bobbybog

Programmer
May 14, 2002
2
US
I am building a company wide database program with Access. I use VBA to evaluate multiple fields. What I need to do is, when the function I wrote is at the end, I want to change the text color to red if a certain condition applies. I can write the IF THEN statement for the condition, but I do not know what the syntax is to change the color of the value in the variable. Could anyone help me???

Thanks in advance!

Bobby
 
Do you mean change the color of the text displayed in a control?

If so, you can simply use its Fore Color property, which must be expressed as an integer...

I have used this in the past & it works well... James Goodman
 
Actually, the way the form is working right now, is with a subreport inside of a tab control. This subreport runs from a query. Within the query, there is a function that runs on one of the fields. What I want to do is color the text that is generated from the function. The function is wrote with VBA, and the end result is a variable. I want to change the color of that variable. Bobby D. Boggess
Database Administrator/Developer
 
I dont entirely understand what you mean, because surely a variable is just a piece of data stored in a piece of memory, & as such has no color?

However, you could edit the function so that it either sets a global variable value, or returns a specific color-related variable (I mean a seperate variable in addition to the variable returned by the function). This could then be read by the form/report & you could color the controls based upon this value... James Goodman
 
Actually, the way the form is working right now, is with a subreport inside of a tab control.

This I have to see. Don't you mean a subFORM in side of a tab control page?

A2K and above allow conditional formatting. Click the field in your subform design that you want to change the FOREGROUND color of, and select FORMAT on the menu, and CONDITIONAL FORMATTING on the drop down. It should work just fine.

Jim

PS to Jim Goodman:

Actually, you can also use any of the VB color constants to specify FOREcolor too (or BACKcolor, for that matter:

me!TextBox.Forecolor = vbRED

I can never remember all the integer values..:)



How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top