column width changes report header width

J

jmoore

I am posting this a second time hoping this subject explains my problem
better and someone can help.

I would like to have the detail section display only 2 inches wide with an
alternating back color. I tried to do this by setting the page layout as a
single column. This displays the data correctly, but the report
header/footer are
cut off. If I leave the page set up without a column, the alternating back
color spans the entire width of the report, about 7.5 inches. Is there a
way to have
alternating back color only behind the text boxes? Or, a way to identify a
single column width that will not change the report header width. Thank you!
 
C

Clifford Bass

Hi,

Set the Detail section's Alternate Back Color to No Color. Add a text
box to your detail section that is two inches wide and takes up the entire
height of the detail section. Set the Back Style to Normal and the Border
Style to Transparent. Set the Border Width Hairline. Give it a name (i.e.
txtBackground), set its Control Source to =1 and set Running Sum to Over All
or Over Group, depending on your needs. Send the text box to the back,
behind all other controls in the detail section. Create an On Format event
for the detail section and place code in it that will change the color as
desired depending on the value of the control.

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

If txtBackground.Value Mod 2 = 0 Then
' Even row
txtBackground.BackColor = RGB(255, 128, 0)
Else
' Odd row
txtBackground.BackColor = RGB(0, 128, 255)
End If

End Sub

Hope that helps,

Clifford Bass
 

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