Fore Colour conditional on a text field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I have a tiny form with a label acting as a command button. I want to be
able to change the Back Colour of the label dependant on content/no content
of another field on the form. I'm trying the following code, which doesn't
work. What am I doing wrong?

Private Sub Form_Current()
If Not IsNull(txtConfidentialNotes) Then
Me.lblConfidentialNotes.BackColour = 5878528
Else
Me.lblConfidentialNotes.BackColour = 12632256
End If
End Sub

Thanks JohnB
 
BackColor has no U.

If that's not the issue, add:
Debug.Print IsNull(Me.txtConfidentialNotes)
to see if the text box contains something other than Null.
 
Thanks Allen.

Oh dear. Who was it said "two nations separated by a common language". I'll
have to wait until tomorrow to try out your correction but I'm sure you are
right. Will reply again then.

Thanks again, JohnB
 
I'm sure that Allen's fallen victim to the American misspellings on more
than one occasion himself, given he lives in Australia. As a Canadian, it's
caused me grief on occasions as well! <g>
 
Thanks Doug.

As per my reply to Allen, all is OK when I use 'Color'. Just something else
I need to remember.

Cheers, JohnB
 
Back
Top