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

How to sense when a label is full?

P: n/a
I'm delivering a filter-on-the-fly report to my main client.

It's a report that, as part of the Open() event, opens up a little floater
screen that lets the user choose various filtering criteria and then, when the
user clicks "Apply", concocts some SQL and applies it to the report and
documents same by loading up a label in the report's header.

Only fly in the ointment is that I don't know how big the user's filter SQL will
be and I'd like to grow/shrink the label accordingly.

Brute force would be force new lines every so often, count the lines, multiply
the line count by the height of the font and resize the control accordingly.

Is there a more legant way? I know a text box can do the CanGrow/CanShrink
thing - but a text box doesn't work in this situation because it has to be
updated while the report thinks it's printing...and that doesn't seem to be
allowed.

Is there a more elegant way than counting lines?
--
PeteCresswell
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
No need to count the lines Pete. See:
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.
"(Pete Cresswell)" <x@y.z> wrote in message
news:9c********************************@4ax.com...
I'm delivering a filter-on-the-fly report to my main client.

It's a report that, as part of the Open() event, opens up a little floater screen that lets the user choose various filtering criteria and then, when the user clicks "Apply", concocts some SQL and applies it to the report and documents same by loading up a label in the report's header.

Only fly in the ointment is that I don't know how big the user's filter SQL will be and I'd like to grow/shrink the label accordingly.

Brute force would be force new lines every so often, count the lines, multiply the line count by the height of the font and resize the control accordingly.
Is there a more legant way? I know a text box can do the CanGrow/CanShrink thing - but a text box doesn't work in this situation because it has to be updated while the report thinks it's printing...and that doesn't seem to be allowed.

Is there a more elegant way than counting lines?
--
PeteCresswell


Nov 12 '05 #2

P: n/a
Pete,

Can you set the width and the height (in twips) of the label by the Len of the
caption?
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"(Pete Cresswell)" <x@y.z> wrote in message
news:9c********************************@4ax.com...
I'm delivering a filter-on-the-fly report to my main client.

It's a report that, as part of the Open() event, opens up a little floater
screen that lets the user choose various filtering criteria and then, when the
user clicks "Apply", concocts some SQL and applies it to the report and
documents same by loading up a label in the report's header.

Only fly in the ointment is that I don't know how big the user's filter SQL will be and I'd like to grow/shrink the label accordingly.

Brute force would be force new lines every so often, count the lines, multiply
the line count by the height of the font and resize the control accordingly.

Is there a more legant way? I know a text box can do the CanGrow/CanShrink
thing - but a text box doesn't work in this situation because it has to be
updated while the report thinks it's printing...and that doesn't seem to be
allowed.

Is there a more elegant way than counting lines?
--
PeteCresswell

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.