Fore Colour conditional on a text field

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
 
A

Allen Browne

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.
 
G

Guest

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
 
D

Douglas J. Steele

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>
 
G

Guest

Thanks Doug.

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

Cheers, JohnB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top