Changing the back ground colour of a control if the value is null

A

Apples76

I am trying to highlight fields that have null values (blank) in red.

i have tried using the following code but it does nothing.
Private Sub Form_Load()

If [Form_missing_nom_data_qry].[Agents_Name] = IsNull Then _
[Form_missing_nom_data_frm].[Agents_Name].BackColor (255)
End If

End Sub

could somebody please tell me where i am going wrong.

Cheers
 
R

Ron2006

try the test like this

if isnull([Form_missing_nom_data_qry].[Agents_Name]) then
[Form_missing_nom_data_frm].[Agents_Name].BackColor = 255
endif


You may also look into the conditional format aspect of the control.
rightclick on the control and select "conditional format"

Ron
 
A

Apples76

Thanks Ron,

I have tried the method sugested below but have had no luck. have also tried
the conditional formating, but cannot get that to work either.
 
A

Apples76

Any further help will be apreciated.

Apples76 said:
Thanks Ron,

I have tried the method sugested below but have had no luck. have also tried
the conditional formating, but cannot get that to work either.


Ron2006 said:
try the test like this

if isnull([Form_missing_nom_data_qry].[Agents_Name]) then
[Form_missing_nom_data_frm].[Agents_Name].BackColor = 255
endif


You may also look into the conditional format aspect of the control.
rightclick on the control and select "conditional format"

Ron
 
R

Ron2006

have you tried the isnull(me.fieldname) instead of the longer form.?

Also I have sometimes found some fields that responded to "" instead of
isnull.
The test would then be: if me.fieldname = "" then

I can't see the full message right now, but you might try the code in
the ONCurrent event.

Ron
 
Top