Change Forecolor based upon if statement

R

rbb101

On a form I have two controls named [Con1] and [Con2]. On Exit of a third
control [ConComm], I am trying to change the font of Label304 only if [Con1]
And [Con2] are Not empty or Not Null.

So If both [Con1] and [Con2] have entries,
then Me.Label304.Forecolor=50787 Else (if there are no entries)
Me.Label304.Forecolor= 6697728
 
M

Marshall Barton

rbb101 said:
On a form I have two controls named [Con1] and [Con2]. On Exit of a third
control [ConComm], I am trying to change the font of Label304 only if [Con1]
And [Con2] are Not empty or Not Null.

So If both [Con1] and [Con2] have entries,
then Me.Label304.Forecolor=50787 Else (if there are no entries)
Me.Label304.Forecolor= 6697728


If the for is displayed in single view, you can use VBA code
to do that:

If Not IsNull(Con1) And NotIsNull(Con2) Then
Me.Label304.Forecolor=50787
Else 'if there are no entries
Me.Label304.Forecolor= 6697728
End If
 
R

rbb101

Thanks. Thats exactly what I was looking for.

Marshall Barton said:
rbb101 said:
On a form I have two controls named [Con1] and [Con2]. On Exit of a third
control [ConComm], I am trying to change the font of Label304 only if [Con1]
And [Con2] are Not empty or Not Null.

So If both [Con1] and [Con2] have entries,
then Me.Label304.Forecolor=50787 Else (if there are no entries)
Me.Label304.Forecolor= 6697728


If the for is displayed in single view, you can use VBA code
to do that:

If Not IsNull(Con1) And NotIsNull(Con2) Then
Me.Label304.Forecolor=50787
Else 'if there are no entries
Me.Label304.Forecolor= 6697728
End If
 

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