By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,635 Members | 2,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,635 IT Pros & Developers. It's quick & easy.

Reports: Formatting can grow / can shrink fields to the largest box.

P: n/a
Hello,

I have a report that contains a memo field that can contain quite a bit of
information. There are actually a couple of fields like this. When I use
can grow / can shrink, the report looks to be a mess. I have visible
borders on the fields, which is how the customer wants it, but I would like
to have all the fields uniform, so that all the fields are as tall as the
tallest field. I.e. if the memo field expands the height of it's field to
2" tall, I'll like all the other fields to be 2" tall as well.

Any ideas how to do this?

Thanks!
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hmmm, interesting. Here's a quick hack that seemed to work when I
tested it.

First, set the TAG property of any controls that you want to resize to
"Size" (without the " quotes).

Then, place this hack in the "On Format" event of the section of the
report that contains the controls to be resized. I used the detail
section.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ctr As Control
Dim hgt As Variant

hgt = 0

For Each ctr In Me.Controls
If ctr.Tag = "Size" Then
If ctr.Height > hgt Then hgt = ctr.Height
End If
Next

For Each ctr In Me.Controls
If ctr.Tag = "Size" Then
ctr.Height = hgt
End If
Next
End Sub

If you want to resize ALL the controls in the section then don't bother
with setting the tag to "size" and remove the lines of code looking for
it. It'll save you some time setting up the report especially if you
are adding and removing fields.
HTH

Nov 13 '05 #2

P: n/a
Unfortunately, the final CanGrow(n) height of the TextBox is not
available until the Print event where you are not permitted to resize
controls.

The OPs two options are:

1) Use the Line method of the Report object to draw the boxes
programmatically in the Print event. Scroll down the page to the older
non class based solutions.
http://www.lebans.com/PrintLines.htm

or

2) Use the TextWidthHeight functions on my site in the Format event of
the relevant section.
http://www.lebans.com/textwidth-height.htm
TextHeightWidth.zip is a replacement for the Report object's TextWidth
and TextHeight methods. It is multiline aware and can work in both
Report and Form views. Includes a sample report to show you how to
autosize individual controls with different formatting on the same line
to simulate RTF style text.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Wolf" <sp*************@hotmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hmmm, interesting. Here's a quick hack that seemed to work when I
tested it.

First, set the TAG property of any controls that you want to resize to
"Size" (without the " quotes).

Then, place this hack in the "On Format" event of the section of the
report that contains the controls to be resized. I used the detail
section.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim ctr As Control
Dim hgt As Variant

hgt = 0

For Each ctr In Me.Controls
If ctr.Tag = "Size" Then
If ctr.Height > hgt Then hgt = ctr.Height
End If
Next

For Each ctr In Me.Controls
If ctr.Tag = "Size" Then
ctr.Height = hgt
End If
Next
End Sub

If you want to resize ALL the controls in the section then don't bother with setting the tag to "size" and remove the lines of code looking for it. It'll save you some time setting up the report especially if you
are adding and removing fields.
HTH


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.