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!

Changing color based on data

Status
Not open for further replies.

MDJ52

MIS
Mar 30, 2001
120
US
I have a form that can display up to 50 parts for 1 master part.
I want to be able to change the color of the description based on whether we have inventory or not.
When the form 1st comes up, it displays all black text boxes. If there is quantity of any kind in our inventory based on part number I want to be able to change the text color of the description field to red.
My current macro that checks the inventory finds inventory and changes all descriptions in the list to red, even though only a third of the records have inventory.
This is a continuous forms setup, with all text in a detail section.
I cannot seem to change only the record affected by the inventory check macro.
Thanks for any help.

 
MDJ52, This is a problem with Continuous Forms that we talk about quite a bit here.

If you're using Access 2000, I have heard of a function called "Conditional Formatting" that should solve your problem. Check help.

If you're using Access '97, it gets a little tricky.

You can't change the format for a control on individual records. However, you can change the value.


In design view, add an unbound textbox that is the same size as your description textbox. Set the properties for this unbound textbox so it is transparent. Set the forecolor to red.

Place the unbound textbox directly on top of your description text box.

In the Control Source for the unbound textbox, type
Code:
     = IIf(quantity > 0, [description],"")
The word 'quantity' has to refer to the appropriate control and description would have to refer to the textbox that you want to display in red.

What this does is cover your description textbox with a red copy of itself.

I know this only gives the appearance of formatting, but it seems to be as close as we can get.

Hope it helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top