Different Coloured Fonts

rhounsome

Registered User.
Local time
Today, 12:38
Joined
Jul 16, 2001
Messages
36
Sounds stupid I know but can anyone tell me how to achieve the following.

I have built an expression to indicate if a persons record is

A) Current
B) Due for Renewal
C) Expired!

=IIf(Now()>[Expiry Date],"EXPIRED!",IIf(Now()>[Expiry Date]-31,"RENEWAL DUE","ACTIVE"))

How can I set it for each possible answer to appear as a different colour to help identify the record when viewing the form.

Can this be done in an expression or should it be written in macro.
 
You can put the following code in the On_Current event of your form... This will change each textbox's forecolor as it comes up...

Code:
    If Now > Me![Expiry Date] Then
        Me![Expiry Date] = "Expired!"
        Me![Expiry Date].ForeColor = vbBlue
    ElseIf Now > (Me![Expiry Date] - 31) > 0 Then
        Me![Expiry Date] = "Renewal Due"
        Me![Expiry Date].ForeColor = vbGreen
    Else
        Me![Expiry Date] = "Active"
        Me![Expiry Date].ForeColor = vbRed
    End If


Hope this helps..

Doug
 
... or select the field on the form, use Format | Conditional formatting from the main menu bar (Access 2000), and set the conditions as required. Works fine for me, and no coding required.

John
Bristol UK
 

Users who are viewing this thread

Back
Top Bottom