Shading Every Other Detail Line on a Report

A

Angie

Hello,
I used this article to shade every other detail in a report.
http://www.support.microsoft.com/kb/210392/EN-US/

it worked beautifully for about three weeks. suddenly for no apparent
reason, it is giving me a problem. when i print preview it, i get a "run-time
error '2427' you entered an expression with no value". Here is my code. It is
highlighting the first line:
Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)

Const SIENNA = 3762381
Const GREY = 13481631


If (Me![LineNum] Mod 2) = 0 Then
Me![Week].BackColor = GREY
Me![Label12].BackColor = GREY
Else
Me![Week].BackColor = SIENNA
Me![Label12].BackColor = SIENNA
End If
End Sub

I also followed the LineNum text box on this tutorial, with Control Source
being =-1. etc.
This is frustrating because there seems to be NO difference between last
week and this one.
Any help would be very much appreciated.
Thanks,
Angie
 
F

fredg

Hello,
I used this article to shade every other detail in a report.
http://www.support.microsoft.com/kb/210392/EN-US/

it worked beautifully for about three weeks. suddenly for no apparent
reason, it is giving me a problem. when i print preview it, i get a "run-time
error '2427' you entered an expression with no value". Here is my code. It is
highlighting the first line:
Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)

Const SIENNA = 3762381
Const GREY = 13481631

If (Me![LineNum] Mod 2) = 0 Then
Me![Week].BackColor = GREY
Me![Label12].BackColor = GREY
Else
Me![Week].BackColor = SIENNA
Me![Label12].BackColor = SIENNA
End If
End Sub

I also followed the LineNum text box on this tutorial, with Control Source
being =-1. etc.
This is frustrating because there seems to be NO difference between last
week and this one.
Any help would be very much appreciated.
Thanks,
Angie


This seems like an awful method to 'shade every other line'.
You're not shading the line, just the backcolor of (a) specific
control(s).

If you wish to shade the line, you do not need the [LineNum] control.

Make sure the BackStyle of each control in the section is Transparent.

Code the section's Format event:

If Me.Section(X).BackColor = vbWhite Then
Me.Section(X).BackColor = 12632256 ' gray
Else
Me.Section(X).BackColor = vbWhite
End If
========
Where the "X" in Section(X) is the section number.

Change the colors as needed.
 
J

Joey

Angie,
I'm certainly no expert on this, but I have had a similar problem. You might
try creating a new db and import all forms, reports, modules, ect. into the
new db.
Sometimes something gets corrupt and things just won't run right. This has
worked well for me in the past.



fredg said:
Hello,
I used this article to shade every other detail in a report.
http://www.support.microsoft.com/kb/210392/EN-US/

it worked beautifully for about three weeks. suddenly for no apparent
reason, it is giving me a problem. when i print preview it, i get a "run-time
error '2427' you entered an expression with no value". Here is my code. It is
highlighting the first line:
Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)

Const SIENNA = 3762381
Const GREY = 13481631

If (Me![LineNum] Mod 2) = 0 Then
Me![Week].BackColor = GREY
Me![Label12].BackColor = GREY
Else
Me![Week].BackColor = SIENNA
Me![Label12].BackColor = SIENNA
End If
End Sub

I also followed the LineNum text box on this tutorial, with Control Source
being =-1. etc.
This is frustrating because there seems to be NO difference between last
week and this one.
Any help would be very much appreciated.
Thanks,
Angie


This seems like an awful method to 'shade every other line'.
You're not shading the line, just the backcolor of (a) specific
control(s).

If you wish to shade the line, you do not need the [LineNum] control.

Make sure the BackStyle of each control in the section is Transparent.

Code the section's Format event:

If Me.Section(X).BackColor = vbWhite Then
Me.Section(X).BackColor = 12632256 ' gray
Else
Me.Section(X).BackColor = vbWhite
End If
========
Where the "X" in Section(X) is the section number.

Change the colors as needed.
 

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