Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Height of a Report Section

Status
Not open for further replies.

cityboy3

Programmer
Nov 6, 2002
41
US
I am trying to use the Line method to draw a rectangle around the detail section of my report. The detail section contains 2 subreports, both of which CanGrow. The detail section itself also CanGrow.

I am calling the line method as follows (snippet) from the OnPrint of the Detail section:

sngTop = rpt.ScaleTop
sngLeft = rpt.ScaleLeft
sngWidth = rpt.ScaleWidth
sngHeight = rpt.ScaleHeight
lngColor = RGB(0, 0, 0)
rpt.Line (sngTop, sngLeft)-(sngWidth, sngHeight), lngColor,B

The rectangle is not growing with the section. When I put a breakpoint in the code and look at my ScaleHeight values, they never change, even when the section is growing. I've also tried reading the Detail.Height property, but it returns the same value as ScaleHeight.

Interestingly, when I try to read the value of the bottom-most control's position, the value does vary as the section grows. But, if I use that value (+the control's height) to draw my rectangle, the bottom line of the rectangle disappears as if it is somehow trying to write beyond the section.

Any ideas? thanks
 
I'm not sure you are capturing the height and width of the detail section. Also, you suggested the other method failed. It might be resolved based on your code using "Step" in the rectangle height.

In addition, looking at your code, keep in mind the argument placement is (X1,Y1)-(X2,Y2). I think you have these reversed.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks for responding. I'm not sure what you mean by using "step". Here's how I worked around it in the meantime: I drew a line under all the controls in my detail section and set its Visible property to No. Then I set the bottom of the rectangle to the Top property of that line. Seems to work fine, I just have no idea why...
 
Step allows you to specify the second coordinates as relative rather than absolute.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top