473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
2 7122
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mal | last post by:
I have an ACC 2000 database that has a strange behaviour I have a small table, with just a few fields... My report has very simple grouping and sorting, no code bar a NODATA event. I have a...
2
by: Von Bailey | last post by:
I have a form where the conditional formatting is set on some fields to bold if certain conditions are met. However, when the conditions are met some of the data that is to bold is either not...
2
by: Darryl Kerkeslager | last post by:
As the subject above hopefully makes clear, I want to do several reports, "with lots of fields not otherwise in database". These reports also have variable-length text. I have defined the...
5
by: simonmarkjones | last post by:
I want to print a report which displays the database items in rows. For each entry in the database there can be up to 3 cost codes. I have put each cost code in 3 different text boxes on my...
0
by: ghadley_00 | last post by:
Hi, I have a report that has fields that grow/shrink. These reports each have an image as a background. For records that cause the boxes to shrink / grow I get a second page that only has the...
11
by: Edson Peacock | last post by:
I have a report with sub reports, one of the subreports have 12 text boxes that are 2" high and I want them all to grow if one goes to 3" high. If anyone has any suggestions they are very much...
1
by: Jimmy Stewart | last post by:
I used the labal wizard to create a report to print mailing labels. When I did, access uses the trim() function for each of the text fields. My labels contain 4 lines... name, name2, address,...
4
by: D.Stone | last post by:
I am having problems formatting an Access 2003 report which is trivial in the extreme (tabular layout, 9 fields from 1 table per row in the detail section, no groups/totals). One field (only) in...
3
by: Galka | last post by:
Hello Environment: Windows XP, MS Access 2003. I'd like - in a report - to save space , when there is no company data. When there is, I print out company name, address, telephone number and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.