Using Me.Line to draw filled boxes

Peter Reid

Registered User.
Local time
Today, 22:53
Joined
Dec 3, 2003
Messages
134
Does anyone know if it is possible to use the Me.Line (X1, Y1)-(X2, Y2), Color, BF (or any other) function to draw a box in 'send to back' mode on a report?

I was hoping it would draw the box as a background for other text on the report but it is being drawn over it.
 
You can't change the z-order of the Line. I suppose it stays on top because it's the last control that was "added" to the report.

What is your main objective that made you want to draw a line?
 
Thanks for the reply.

I have a fairly complex report which has a sub-report and a handful of other text boxes in the detail section. All are the same height of the detail section.

The subreport has a background meaning the printed page has a continuous background from top to bottom (excluding page header/footer).

Unfortunately, some of the data does not fit into the text boxes or space allowed for the subreport so these have all been changed so they 'can grow'.

When the text boxes grow, I lose the continuous background behind the subreport.

I had a similar problem with the vertical lines which I resolve with the Line functionality and hoped it would solve the background problem as well.

I can load an example db over the weekend if the above makes no sense

Edit: I'm using A2007 but have the option to go to A2010 if there is a solution in there
 
Last edited:
A screenshot with some arrows and labels pointing to the problems you're experiencing will suffice for now.
 
From what has been said so far I can’t determine if the lines are being drawn on the report or the sub-report.

From my experience all lines drawn on a report, or sub-report, are drawn behind other controls on the same report or sub-report. What this meant is that if you wanted to draw over a control then the control needed to be on the report and the line drawn on the sub-report.

So, if you want the lines behind the controls draw the lines on the report with the controls.
If you want the lines on top of the controls, put the controls on the report and draw the lines on the sub-report.

Chris.
 
Thanks again for the replies and apologies for the delay replying.

I've attached 2 example screenshots, CurrentReport.png which is how my current report looks and DesiredReport.png which is how I would like it to look, if possible.

The colour & size info comes from a subreport which 'can grow' while the Item, ServiceItem and AddOnItem field are comboboxes which also 'can grow'.

If the combo boxes grow larger than the subreport, I get 'blank' spaces when the intention is to have a continuous background in between the page header and footer.

If the Line functionality cannot draw a filled box 'behind' the subreport, do I have any other options?
 

Attachments

  • CurrentReport.PNG
    CurrentReport.PNG
    68.6 KB · Views: 627
  • DesiredReport.PNG
    DesiredReport.PNG
    28.5 KB · Views: 549
You will need to draw the line on the subreport. Do this in the Print event of the section (which would most likelty be the Detail section).
 
On the parent Report: -
Code:
Private Sub Detail_Print(ByRef intCancel As Integer, _
                         ByRef intPrintCount As Integer)
                         
    With Me("ctlSubReportControl")
        [color=green]' Note: Online help uses (Top, Left)(bug) rather than (Left, Top)[/color]
        Me.Line (.Left, 0)-(.Width, 32766), 12632256, BF
    End With
    
End Sub

HTH.

Chris.
 
Thanks again for the replies.

I've added the code as suggested by Chris0 and it does exactly as I need.

Note sure I understand why this draws the box behind the subreport when my original experience was that the box was drawn over the subreport and I've unfortunately deleted my previous code so can't compare.

Still, thanks again
 

Users who are viewing this thread

Back
Top Bottom