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

Conditional Formatting assistance

Status
Not open for further replies.

Modex

Programmer
Sep 15, 2002
155
GB
(Access 2000)Within an application I am attempting to write, I am using conditional formating to change colour of the text in an unbound box from green to red depending on the time, which works great.

However,

What I would like to do is test for the colour of the text once the form has loaded and then perform another action depending on the whether the text is red or green.

I have tried all the usual "after update", "on activate" etc to test for the colour of the text and nothing works.

Anybody any ideas how I can trap this number, it driving me mad.

Many thanks in advance
ModeX
 
Hi

Instead of trying to test for the colour, why don't you just test for the condition that is used to set the colour in the conditional formatting

Tom
 
I think I was probably being a little Simplistic in my request.

I am basically testing a time calculation taking a time value and comparing it with now() and if [time_field] has gone past now() the text changes to Red, but if its before the end time the text stays green.

The form supports continuous records and displays about 10 records on the page, using conditional formatting each record changes colour depending on the above criteria. However, If I do the same thing using VBA, such as:

If [Date] > now() then
[label_1] = “times up”
else
[label_1] = “Still in time”
End if

Then, when the form is opened it checks the first record and all subsequent records display that result and not the results of each record.

Alternatively, is there anywhere I can look at the code that the conditional formatting uses so I can try and adapt it.

I hope that’s clear; it still looks a little confusing.

Any Help would be really appreciated

ModeX
 
Hi ModeX

Assuming your form is based on a query (if on a table then change it to a query), then try changing the control source of [label_1] to an iif in the query itslf.

e.g.

IIf([Date]>now(),“times up”,“Still in time”)

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top