Varying heights and horizontal alignment

  • Thread starter Thread starter Peter Cole
  • Start date Start date
P

Peter Cole

I have a report that requires a varying height text on the left with a value
on the right aligned with the bottom of the left box.
The detail.height in AC 2002 does not seem to be able to be set. The data is
built from numerous fields using VBA.
Thanks
Peter

Sample text in left
With more lines
Depending
500.00
 
Peter said:
I have a report that requires a varying height text on the left with a value
on the right aligned with the bottom of the left box.
The detail.height in AC 2002 does not seem to be able to be set. The data is
built from numerous fields using VBA.


I've been scratching my head all day on this one and think I
finally thought of a way.

First go to www.lebans.com and download the TextHeightWidth
db. Then import the modTextHeightWidth module into your
application and Compile it. In the report make sure that
the vallue text box on the right has the same Font,
Fontsize, Bold, etc properties as the varying text box on
the left.

With that in place, here's some code that demonstrates how
to get the value to align with the last line of the left
text box (in the detail section's Format event).

Dim lngLines As Long
fTextHeight txtRemarks, , , , lngLines
If lngLines > 0 Then
righttextbox = Replace(String(lngLines - 1, "~"), _
"~", vbNewLine) & thevalue
Else
txtLines = thevalue
End If
 
Thanks Marsh
That worked fine. I had to take Currency Format of the right box as that
prevented it working correctly.

I had been trying lebans TextHeightWidth using the height in twips and then
setting .height and .top but it only seemed to work sometimes.
 
Peter said:
Thanks Marsh
That worked fine. I had to take Currency Format of the right box as that
prevented it working correctly.

I had been trying lebans TextHeightWidth using the height in twips and then
setting .height and .top but it only seemed to work sometimes.

Aside from the issue of converting twips to lines, I'm
pretty sure the sometimes problem is that prior to AXP you
can not use the Format event to set Height or Top if the new
bottom would be below the ungrown bottom of the section.
Unfortunately, you can not set the Top or Height in the
Print event, period.

FYI, there is another way that can get close. Use the Print
method in the Print event (where the final height of the
left text box is available), but I don't know of a way to
accurately set CurrentX and CurrentY.
--
Marsh
MVP [MS Access]


 
Back
Top