Auto Fill field with color

TallMan

Registered User.
Local time
Today, 14:02
Joined
Dec 5, 2008
Messages
239
Good Morning-

I have a sub-form which has about 15 fields one field is called Cancel_Date. What I need to happen is if the Cancel_field is not null then the Account_number field turns red.

I have tried conditional formatting but it colors the whole column red not just the individual fields that have Cancel dates.

Has anyone done this before?

Thanks for any help.

Tallman.
 
Ive used this before:

If IsNull(Me.CancelDate) Then
Else
[AccountNumber].BackColor = RGB(255,0,0)
End if

Is your sub-form continuous though? If it isnt then it should work - Just put it in the OnCurrent event of the subform.
 
Ooh, I just remembered something that happened to me... Once it had gone red then it stayed red for all further records, if this happens, you might need to change the code to

If IsNull(Me.CancelDate) Then
[AccountNumber].BackColor = RGB(255,255,255) 'White
Else
[AccountNumber].BackColor = RGB(255,0,0) 'Red
End if
 
I have tried conditional formatting but it colors the whole column red not just the individual fields that have Cancel dates.
Conditional formatting SHOULD work for you. It should not turn a whole column UNLESS your control is UNBOUND. If the Cancel_field is not bound to the table, you will have this problem.
 
Oh, and if the control is unbound Branston's code will not work for you either.
 

Users who are viewing this thread

Back
Top Bottom