Conditional Formatting through VBA works in print preview but nowhere else!

  • Thread starter orographicfish via AccessMonster.com
  • Start date
O

orographicfish via AccessMonster.com

I'm trying to put together a report in Access 2007 where the detail record is
displayed as a different background color depending on the value of a field.
There are more than 3 conditions, so I've opted to attempt this via VBA. It
works- but only in print preview.... Why? I can't figure out what I'm doing
wrong. I'm sure it's something simple, but I'd really appreciate some help
on this one.

Code:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Select Case Me![Status]
Case 8
Me![Text43].BackColor = RGB(165, 165, 79)
Me![Text43].BackStyle = 1

Case 1
Me![Text43].BackColor = vbCyan
Me![Text43].BackStyle = 1
Case 2 To 3
Me![Text43].BackColor = vbRed
Me![Text43].BackStyle = 1
Case 4, 5, 7
Me![Text43].BackColor = vbGreen
Me![Text43].BackStyle = 1
Case Else
Me![Text43].BackColor = vbYellow
Me![Text43].BackStyle = 1
End Select
End Sub
 
O

orographicfish via AccessMonster.com

Is there a way to conditionally format the background appearance of the
detail section based on a field's value in Report View? I need this to work
for display- not just for printing.

Duane said:
Code will only run in Print and Print Preview modes.
I'm trying to put together a report in Access 2007 where the detail record
is
[quoted text clipped - 31 lines]
End Select
End Sub
 
D

Duane Hookom

Use the print preview.

--
Duane Hookom
MS Access MVP


orographicfish via AccessMonster.com said:
Is there a way to conditionally format the background appearance of the
detail section based on a field's value in Report View? I need this to
work
for display- not just for printing.

Duane said:
Code will only run in Print and Print Preview modes.
I'm trying to put together a report in Access 2007 where the detail
record
is
[quoted text clipped - 31 lines]
End Select
End Sub
 

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