Report Can Grow not aligned horizontally

  • Thread starter Thread starter Viking
  • Start date Start date
V

Viking

I have a report where I have 1 row of text, memo, number, and date fields.
The memo field can contain up to 4-5 lines of wrapped text. I have set all
teh rows to "can grow". However, on my report, the conditional formatting
doesn't grow.

For instance, the fill (which I have set to a gray color) in the memo field
is about 3 lines deep when there is a lot of text in the memo field, but the
text and number fields associated with that record are actually only 1 line.
This essentially looks like a mess, small gray filled boxes for the text
fields and a large gray filled box for the memo field.

I just want simple rows that have the same height (they actually have the
same height per se, but the fill of the record doesn't match up).

Using columnar layout in access 2010 solves the problem, but then the
database is not able to be open in 2007, which renders it essentially useless.

Any thoughts?
 
If the text boxes all have their background set, I'm not sure why you don't
set the background of the detail section.

However if you want to set the background of one or more controls in the
report section, you can set the Tag property of these controls to "Border".
Then add this code to the On Print event of the section:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim intMaxHeight As Integer
Dim ctl As Control
Dim lngHilite As Long
lngHilite = 10092543 'pale yellow
'Find highest control in Detail section _
that has a tag property of "Border"
For Each ctl In Me.Section(0).Controls
If ctl.Tag = "Border" Then
If ctl.Height > intMaxHeight Then
intMaxHeight = ctl.Height
End If
End If
Next
'Draw a box around each control in Detail _
that has a tag property of "Border"
For Each ctl In Me.Section(0).Controls
If ctl.Tag = "Border" Then
'make the background pale yellow
Me.Line (ctl.Left, ctl.Top)- _
Step(ctl.Width, intMaxHeight), lngHilite, BF
Me.Line (ctl.Left, ctl.Top)- _
Step(ctl.Width, intMaxHeight), vbBlack, B
End If
Next
End Sub
 
Duane,
This code has been a life saver. I have a question though, to see if you have any ideas. My user wants alternating row colors. Unfortunately, because one of my fields is a subreport, the alternate row color feature in 2007 doesnt work. So, I found some code to look at the Current record number, mod it by 2 to determine alternate rows. When this value = 1, I change the backcolor. I also do this in the subreport, and it works fine. However, when I print preview the report, the subreport back color over paints the line border that your code drew. It appers that the rendering order of the subreport, comes after the line drawing and therefor hides the box/border.

Make sense? Any ideas?

Thanks again for your help.
 
Back
Top