back color

kitty77

Registered User.
Local time
Today, 06:14
Joined
May 27, 2019
Messages
717
What is the best way to say this...

I want the back color of a field if not null to be yellow, otherwise the back color will be white. The field name is [memo]

Thanks!
 
Back color as displayed where, exactly? Table or Form or something else?
 
Sorry, onload of a report.
 
use conditional format.
Expression is:
IsNull([memo]) = False
 
This field will either be represented by a control in a header, a footer, or the detail section. To use VBA, you need to find the OnFormat event for that section. However, if the control actually exists in the section, I don't think it is possible for the backcolor to be null. I.e. if the control exists, so does its backcolor. It might be zero (which is equal to vbBlack). Assuming the control name is Memo1, you might have this line in the event code:

Code:
If NZ( Me.Memo1.Backcolor, 0 ) = 0 Then 
    Me.Memo1.Backcolor = vbYellow
Else
    Me.Memo1.Backcolor = vbWhite
End If

or something similar to that.
 
I would rather use VBA instead.
code in VBA will only be "seen" on Print Preview (and not on Report view).
if you use Conditional Format, it will be "seen" on both views.
see sampleReport in this demo.
on design view click on memo textbox and check the Conditional Format on the Ribbon.
 

Attachments

code in VBA will only be "seen" on Print Preview (and not on Report view).
if you use Conditional Format, it will be "seen" on both views.
see sampleReport in this demo.
on design view click on memo textbox and check the Conditional Format on the Ribbon.
Perfect!!!
 

Users who are viewing this thread

Back
Top Bottom