Conditional Formating to use DIfferent Font TYPE ??

  • Thread starter Thread starter kev100 via AccessMonster.com
  • Start date Start date
K

kev100 via AccessMonster.com

I need conditional formatting to use a different font TYPE, size and
italicization.

I saw the programming in previous posts to change the font size and color....


With Me.thetextbox
If <condition> Then
.FontSize = 12
.ForeColor = vbRed
.FontWeight = 700
Else
.FontSize = 10
.ForeColor = vbGreen
.FontWeight = 400
End If
End With


However, I was also needing to change the Font TYPE and use Italics.

Does anyone know the proper coding for those items?

Thanks very much.
 
kev100 said:
I need conditional formatting to use a different font TYPE, size and
italicization.

I saw the programming in previous posts to change the font size and
color....


With Me.thetextbox
If <condition> Then
.FontSize = 12
.ForeColor = vbRed
.FontWeight = 700
Else
.FontSize = 10
.ForeColor = vbGreen
.FontWeight = 400
End If
End With


However, I was also needing to change the Font TYPE and use Italics.

Does anyone know the proper coding for those items?

Thanks very much.

With Me.thetextbox
If <condition> Then
.FontItalic = True
Else
.FontItalic = False
End If
End With
 
I need conditional formatting to use a different font TYPE, size and
italicization.

I saw the programming in previous posts to change the font size and color....

With Me.thetextbox
If <condition> Then
.FontSize = 12
.ForeColor = vbRed
.FontWeight = 700
Else
.FontSize = 10
.ForeColor = vbGreen
.FontWeight = 400
End If
End With

However, I was also needing to change the Font TYPE and use Italics.

Does anyone know the proper coding for those items?

Thanks very much.

add to the above:
................
.FontName = "Times New Roman"
.FontItalic = True
Else
..............
.FontName = "Arial"
.FontItalic = False
 
I've just now been able to look back at that issue.

With the Design View of that report up.....I'm not sure where to actually put
this code. I right-click on the field to access conditional formatting, but
can't find a code window option that specifically refers to that field.

Thanks
I need conditional formatting to use a different font TYPE, size and
italicization.
[quoted text clipped - 18 lines]
Thanks very much.

add to the above:
...............
.FontName = "Times New Roman"
.FontItalic = True
Else
.............
.FontName = "Arial"
.FontItalic = False
 
I've just now been able to look back at that issue.

With the Design View of that report up.....I'm not sure where to actually put
this code. I right-click on the field to access conditional formatting, but
can't find a code window option that specifically refers to that field.

Thanks
I need conditional formatting to use a different font TYPE, size and
italicization.
[quoted text clipped - 18 lines]
Thanks very much.

add to the above:
...............
.FontName = "Times New Roman"
.FontItalic = True
Else
.............
.FontName = "Arial"
.FontItalic = False

This has nothing to do with the Conditional Formatting property of a
control. It's Code. It goes in whatever section of the report's Format
event the control is placed in.

If the control is in the Detail section, right-click on the Detail
section and select properties.
Select the Event tab of the property sheet.

Write
[Event Procedure]
on the Format line.
Then click on the little button with 3 dots that appears on that line.
When the code window opens the cursor will be flashing between 2
already existing lines of code. Between those lines, write:

If [SomeControl] = criteria Then
With [Me![ControlName]
.FontSize = 12
.ForeColor = vbRed
.FontWeight = 700
.FontName = "Times New Roman"
.FontItalic = True
End With
Else
With Me![ControlName]
.FontSize = 10
.ForeColor = vbGreen
.FontWeight = 400
.FontName = "Arial"
.FontItalic = False
End With
End If


Change [SomeControl] and [ControlName] to whatever the actual control
names are.
Change criteria to whatever the actual criteria value should be.
Remove any none wanted lines of code above.
 
I've just now been able to look back at that issue.

With the Design View of that report up.....I'm not sure where to actually put
this code. I right-click on the field to access conditional formatting, but
can't find a code window option that specifically refers to that field.

Thanks
I need conditional formatting to use a different font TYPE, size and
italicization.
[quoted text clipped - 18 lines]

Thanks very much.

add to the above:
...............
.FontName = "Times New Roman"
.FontItalic = True
Else
.............
.FontName = "Arial"
.FontItalic = False

This has nothing to do with the Conditional Formatting property of a
control. It's Code. It goes in whatever section of the report's Format
event the control is placed in.

If the control is in the Detail section, right-click on the Detail
section and select properties.
Select the Event tab of the property sheet.

Write
[Event Procedure]
on the Format line.
Then click on the little button with 3 dots that appears on that line.
When the code window opens the cursor will be flashing between 2
already existing lines of code. Between those lines, write:

If [SomeControl] = criteria Then
With [Me![ControlName]
.FontSize = 12
.ForeColor = vbRed
.FontWeight = 700
.FontName = "Times New Roman"
.FontItalic = True
End With
Else
With Me![ControlName]
.FontSize = 10
.ForeColor = vbGreen
.FontWeight = 400
.FontName = "Arial"
.FontItalic = False
End With
End If

Change [SomeControl] and [ControlName] to whatever the actual control
names are.
Change criteria to whatever the actual criteria value should be.
Remove any none wanted lines of code above.

Whoops. I inadvertently left a [ in the code.
Change:
With [Me![ControlName]
to:
With Me![ControlName]
 
Thanks very much.

I've gotten more familiar with reports, etc (using the access wizards and
drop/drag methods) but am new to adding code (in Access).

What I did to access that Event area was to open the existing report in
design mode and right-clicked the box that specifies were that text will
appear....then.....properties. This brought up the tabs. Under the Event
tab, it is simply all solid. There is not a blank form or field....just
solid gray.

Do I needed to activative something somewhere else first?

(Using MS Office 2002)

Thanks
[quoted text clipped - 56 lines]
Change criteria to whatever the actual criteria value should be.
Remove any none wanted lines of code above.

Whoops. I inadvertently left a [ in the code.
Change:
With [Me![ControlName]
to:
With Me![ControlName]
 
Thanks very much.

I've gotten more familiar with reports, etc (using the access wizards and
drop/drag methods) but am new to adding code (in Access).

What I did to access that Event area was to open the existing report in
design mode and right-clicked the box that specifies were that text will
appear....then.....properties. This brought up the tabs. Under the Event
tab, it is simply all solid. There is not a blank form or field....just
solid gray.

Do I needed to activative something somewhere else first?

(Using MS Office 2002)

Thanks

*** snipped ***
Regarding: >and right-clicked the box<
What box?

You are supposed to click on the Detail section itself (not on any
control or label in the detail section), then select the Format event.
Enter [Event Procedure], then click on the button with the 3 dots.

The caption of the property sheet should say
Section: Detail
 
Back
Top