Hi,

I have a form with datasheetview.

I want to add conditional formatting to some textboxes. I have to do this via code, because it can be variable. (The expression compares the vendor-price with the client-price.)

I add the conditional formatting on OnOpen-event. Is this ok? The problem is that the fields have a NULL-value at that time, I guess, because it crashes on the expression. What am I doing wrong? Via the dialogboxes this works, but via code it crashes.
(Type mismatch error)

---- Code: -----

Me.TCP_VENDOR.FormatConditions.Delete



Set objFrc = Me.TCP_VENDOR.FormatConditions.Add(acExpression, acGreaterThan,
[TCP_VENDOR] > [TCP_CLIENT] / 1.3)
objFrc.BackColor = RGB(255, 0, 0)