Setting .Detail.Height not taking

R

Rod

This one seems a little bizarre:

At the OnFormat event I re-set to heights of some fields in the detail
section of a report based on certain criteria. I keep a running total of the
overall height of the section and, at the end of the event procedure, re-set
the height:

Me.Detail.Height = valDetailHeight

Because this didn't seem to be working, I inserted a debug.print immediately
after this line to report on the actual values of Me.Detail.Height and
valDetailHeight. Although for most rows of the report, the two values are the
same, sometimes the values are different by a good few hundred twipps.

What seems utterly bizarre is that I have just set the value of
Me.Detail.Height to equal valDetailHeight and yet, in the very next line of
code (debug.pring Me.Detail.Height & ", " & valDetailHeight) the two values
are different! How can this be?
 
M

Marshall Barton

Rod said:
This one seems a little bizarre:

At the OnFormat event I re-set to heights of some fields in the detail
section of a report based on certain criteria. I keep a running total of the
overall height of the section and, at the end of the event procedure, re-set
the height:

Me.Detail.Height = valDetailHeight

Because this didn't seem to be working, I inserted a debug.print immediately
after this line to report on the actual values of Me.Detail.Height and
valDetailHeight. Although for most rows of the report, the two values are the
same, sometimes the values are different by a good few hundred twipps.

What seems utterly bizarre is that I have just set the value of
Me.Detail.Height to equal valDetailHeight and yet, in the very next line of
code (debug.pring Me.Detail.Height & ", " & valDetailHeight) the two values
are different! How can this be?


It's been a while since I played around with setting a
section's height (new feature in A2003). I don't know
enough about what you did to have an answer, but the whole
situation is more than a little tricky.

You can not set the section height in such a way that it
would affect the height of a control. Conversely, you can
not set the position or size of a control beyond the
section's current boundaries. This means you have to make
the section larger before you increase the size of the
controls, which is alnost a catch 22.

Another important point is that the changed properties of
either the section or controls will continue in effect until
you set them again. I.e. you need to set all the properties
every time the Format event procedure runs.

Note that using the CanGrow/CanShrink properties will
conflict in strange ways with setting the section's Height.
 
R

Rod

Cheers, Marshall, but I was looking for a little more detail.

If I set a control's height or top value in such a way as to exceed the
height of the section, I get an error message informing me. Conversely, if I
decrease the height of a section to a point where it would exclude a control,
I get an error message.

My point is that I am explicitly assigning the value by saying:

Me.Detail.Height = myValue

I get no error, yet on the very next line it is obvious that this line of
code has not been properly executed, since the values of Me.Detail.Height and
myValue differ:

Debug.Print Me.Detail.Height & " : " & myValue

Why does Access not at least give me an error message?
 
M

Marshall Barton

I don't remember getting an error message in all or even
most situations so I can't say that the lack of a message is
significant. Actually, I think you can set the height of a
control beyond the section's bottom and the section's height
will adjust accordingly (this might be worth an experiment,
but not today).

You said that the two values are different, but how are they
different? Error messages aside, I would expect the section
Height to be greater if there is a control that prevents the
section's height from being set to a smaller value.

The section height will also end up (in the print evnt?)
greater if the section needs to grow, regardless of what
value you assign to the height. I have never seen the
section height be less than the assigned value (except when
the section shrinks).

Sorry that I'm so uncertain about all this, but this is an
esoteric thing to do and I don't know anyone that has
determined the idiosyncrasies of all possible cases.
However, I really think that you have somhow failed to
account for the top/height of all the controls.
 

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