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:9cae00drao98lc4j3h1prmns1bto3lbddu@4ax.com...[color=blue]
> 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[/color]
floater[color=blue]
> screen that lets the user choose various filtering criteria and then,[/color]
when the[color=blue]
> user clicks "Apply", concocts some SQL and applies it to the report[/color]
and[color=blue]
> 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[/color]
filter SQL will[color=blue]
> be and I'd like to grow/shrink the label accordingly.
>
> Brute force would be force new lines every so often, count the lines,[/color]
multiply[color=blue]
> the line count by the height of the font and resize the control[/color]
accordingly.[color=blue]
>
> Is there a more legant way? I know a text box can do the[/color]
CanGrow/CanShrink[color=blue]
> thing - but a text box doesn't work in this situation because it has[/color]
to be[color=blue]
> updated while the report thinks it's printing...and that doesn't seem[/color]
to be[color=blue]
> allowed.
>
> Is there a more elegant way than counting lines?
> --
> PeteCresswell[/color]