SubReport: Determining Size?

P

PeteCresswell

I posted this a few days ago under "Report: Varying Control Positions
Depending On SubReport's Size? " but I'm not getting any nibbles and
am getting desperate. Figuring that maybe it never made it out of
GoogleGroups, I'm posting it again.

Got a report with a subreport.

Subreport has .CanGrow=Yes and .CanShrink=Yes.

In Detail_Format, I'm trying to use .Line to draw an enclosing
rectangle - whose depth will vary depending on how much stuff is in
the subreport.

My problem is that the subreport's .Height always comes back the same:
the size it is when the form is in Design mode. It does not seem to
change as the subreport grows/shrinks in response to containing more
or fewer lines.

Likewise, Section(0).Height seems to remain the same.

e.g.
' --------------------------------------
' Draw the rectangle

1060 With Me
1061 rctMain_Bottom = .Section(0).Height
1069 End With

1990 Me.Line (0, (vPad * 2))-(Me.Width, rctMain_Bottom), RGB(0, 0,
0), B
' --------------------------------------

Should I be doing this in some other event besides Detail_Format?

Does the bit about the subreport's .Height not changing ring true?
 
P

PeteCresswell

Should I be doing this in some other event besides Detail_Format?

I think I've got it: Detail1_Print() is place to do it.
 
B

BruceM

You need to use the Line Method in the report's Print event. The Line
property is something entirely different. I'm not quite sure how to use it,
but from what I can tell it has to do with line numbers in text, not a
physical line from one point to another.

Unfortunately, Help's documentation on the Line method is not very good,
although I have heard that it is described better in Access 97 Help, if that
is available. There may be enough there to help you draw a line such as you
describe.

If you try something like this as a search string in Google groups you
should get a number of relevant responses:
"microsoft.public.access" "line method" "can grow" report

When you post code you need to post all of it, or at least all of the
relevant code. You seem to have some line numbers, then there is
rctMain_Bottom, but there is no way to know what that is. Were you able to
compile the code?
 
B

BruceM

My apologies for misunderstanding. You are indeed using the line method,
although my point about posting more complete code remains.

BTW, for a vertical line drawn using the Line method I believe you can set
it to the maximum height for the section. It will be truncated based on the
section's contents. In other words, the line's height will not determine
the section's height, but rather the reverse.
 

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