Setting the properties of "field1" based upon "field2" in a form

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

Guest

Hi guys,

I have a form with a "yes/no" field (field1) and a text field (field2). I
want to change the font and colour of field2 based upon if field1 is set to
yes or a different font and colour if field1 is set to no.

How do I do this?

Thanks for any helkp you can provide.

Regards
Greg
 
Lateral said:
I have a form with a "yes/no" field (field1) and a text field (field2). I
want to change the font and colour of field2 based upon if field1 is set to
yes or a different font and colour if field1 is set to no.


If the field is displayed in Single Form view, you can use
VBA code in both field1's AfterUpdate event and in the
form's Current event:

If Me.field1 = True Then
Me.field2.FontName = "Arial"
Me.field2.ForeColor = vbGreen
Else
Me.field2.FontName = "Wingdings"
Me.field2.ForeColor = RGB(255, 220,220) ' pink
End If

If your form is displayed in Continuous or Datasheet view,
then you can not change the font using standard features.
There are several properties you can control through the
Conditional Formatting feature. Click on field2, use Format
-Conditional Formatting menu item. Then select the
Expression Is: option and set the expression to:
[field1]
 
Hi Marshall,

I could not get this to work.

Marshall Barton said:
Lateral said:
I have a form with a "yes/no" field (field1) and a text field (field2). I
want to change the font and colour of field2 based upon if field1 is set to
yes or a different font and colour if field1 is set to no.


If the field is displayed in Single Form view, you can use
VBA code in both field1's AfterUpdate event and in the
form's Current event:

If Me.field1 = True Then
Me.field2.FontName = "Arial"
Me.field2.ForeColor = vbGreen
Else
Me.field2.FontName = "Wingdings"
Me.field2.ForeColor = RGB(255, 220,220) ' pink
End If

If your form is displayed in Continuous or Datasheet view,
then you can not change the font using standard features.
There are several properties you can control through the
Conditional Formatting feature. Click on field2, use Format
-Conditional Formatting menu item. Then select the
Expression Is: option and set the expression to:
[field1]
 
I wonder what you did that prevented you from getting it to
work.
--
Marsh
MVP [MS Access]

I could not get this to work.

Marshall Barton said:
Lateral said:
I have a form with a "yes/no" field (field1) and a text field (field2). I
want to change the font and colour of field2 based upon if field1 is set to
yes or a different font and colour if field1 is set to no.


If the field is displayed in Single Form view, you can use
VBA code in both field1's AfterUpdate event and in the
form's Current event:

If Me.field1 = True Then
Me.field2.FontName = "Arial"
Me.field2.ForeColor = vbGreen
Else
Me.field2.FontName = "Wingdings"
Me.field2.ForeColor = RGB(255, 220,220) ' pink
End If

If your form is displayed in Continuous or Datasheet view,
then you can not change the font using standard features.
There are several properties you can control through the
Conditional Formatting feature. Click on field2, use Format
-Conditional Formatting menu item. Then select the
Expression Is: option and set the expression to:
[field1]
 
:)

I will try again and let you know as it looks pretty straightforward.

Regards
Greg

Marshall Barton said:
I wonder what you did that prevented you from getting it to
work.
--
Marsh
MVP [MS Access]

I could not get this to work.

Marshall Barton said:
Lateral wrote:
I have a form with a "yes/no" field (field1) and a text field (field2). I
want to change the font and colour of field2 based upon if field1 is set to
yes or a different font and colour if field1 is set to no.


If the field is displayed in Single Form view, you can use
VBA code in both field1's AfterUpdate event and in the
form's Current event:

If Me.field1 = True Then
Me.field2.FontName = "Arial"
Me.field2.ForeColor = vbGreen
Else
Me.field2.FontName = "Wingdings"
Me.field2.ForeColor = RGB(255, 220,220) ' pink
End If

If your form is displayed in Continuous or Datasheet view,
then you can not change the font using standard features.
There are several properties you can control through the
Conditional Formatting feature. Click on field2, use Format
-Conditional Formatting menu item. Then select the
Expression Is: option and set the expression to:
[field1]
 
Back
Top