I'm trying to add a Format Condition to a text box in a form in VBA.
The text Box is OrderedBy
Both following codes are added in form's onOpen event.
If I use the following code, when the form is opened, Format Condition is not applied:
If I change the above code as following, it works:
Why the first one doesn't work?
Thanks for any kind of advice.
The text Box is OrderedBy
Both following codes are added in form's onOpen event.
If I use the following code, when the form is opened, Format Condition is not applied:
Code:
With Me.OrderedBy
.FormatConditions.Delete
Set fc = .FormatConditions.Add(acFieldValue, acEqual, "Test")
Set fc = .FormatConditions(0)
fc.BackColor = 0
fc.FontBold = True
fc.ForeColor = 255
End With
If I change the above code as following, it works:
Code:
With Me.OrderedBy
.FormatConditions.Delete
Set fc = .FormatConditions.Add(acExpression, , "[OrderedBy]='Test'")
Set fc = .FormatConditions(0)
fc.BackColor = 0
fc.FontBold = True
fc.ForeColor = 255
End With
Why the first one doesn't work?
Thanks for any kind of advice.