By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

Access 2007 - Report Shading

100+
P: 133
Contained within a 2007 database, a report has VBA code for detailed line shading as shown below. However, when a macro executes open report command, the shading does not appear. But appears when printed.

Any suggestions would be appreciated.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private shadeNextRow As Boolean
  5. Const shadedColor = 12632256
  6. ' Const shadedColor = 15726583 ' alternative shade colors
  7. ' Const shadedColor = 14078404
  8. ' Const shadedColor = 13356495
  9. ' Const shadedColor = 14281974
  10. Const normalColor = 16777215
  11.  
  12. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  13.  
  14.   On Error GoTo Detail_Format_Error
  15.  
  16. ' Choose a color based on the shadeNextRow value
  17.   If shadeNextRow = True Then
  18.     Me.Section(acDetail).BackColor = shadedColor
  19.   Else
  20.     Me.Section(acDetail).BackColor = normalColor
  21.   End If
  22.  
  23. ' Switch the color for the next row
  24.   shadeNextRow = Not shadeNextRow
  25.  
  26. Detail_Format_Exit:
  27.   Exit Sub
  28.  
May 13 '10 #1
Share this Question
Share on Google+
1 Reply


100+
P: 133
Got it, the macro needs to specific print preview.
May 13 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.