Format on Text

AN60

Registered User.
Local time
Today, 20:36
Joined
Oct 25, 2003
Messages
283
I wish to format Foreground in a Text only field. I have done it many times using Values but can't get it going for Text. eg. say a field containing names = AN60, I might want the forecolor to be Red.

I have tried something like this;
If Me.MyDateField.XXXX > AN60 Then
Me. MyDateField.ForeColor = vbRed
Else
Me. MyDateField.ForeColor = vbBlue
End If

If I want it based on values I have substituted the XXX's with Value and it will work ok, but for text I obviously need something different.
 
For text you need to put the value in quotes:

If Me.MyTextBox = "AN60" Then...
 
RichO
Thank you. I had tried your suggestion and for some unexplained reason it didn't work, however after reading your post I did it that way again and of course it works. Thanks again. ;)
 
What about a field where Nulls ?
Could I use;
If Me.Myfield.value=null then......
 
Last edited:
Yes, the proper syntax would be...

If IsNull(Me.MyField) Then....
 
RichO
Once again thank you for your assistance. With your help I have it all working 100%. ;)
 

Users who are viewing this thread

Back
Top Bottom