Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize control dynamically based on font/size selected

Status
Not open for further replies.

PurpleUnicorn

Programmer
Mar 16, 2001
79
US
Hi,

I have a form that allows the user to select font/size to be used in a report. I need to know if the text with the selected font will fit on the report - before I close the form. Is there a way to determine the height needed for a control based on the selected font/size. If I can do this, then I can add up the heights for all lines of text and check the sum against the report height.

I have tried setting an unbound field on my form to the selected font/size after the font/size is selected. I have also set CanGrow and CanShrink to yes. The control height does not change.

Anyone have any ideas?

Thanks

Nancy
 
Take the font size and multiply it by 20 you will get the result of twips and then set the height of the text box with the result (you have to open the report in design view first to set the height, Like this.)

Code:
DoCmd.OpenReport "ReportName", acViewDesign

' Set the height

DoCmd.Save acReport, "ReportName"
DoCmd.OpenReport "ReportName", acViewPreview[\code]
 Hope this helps if not let me know

Jn88
Jn88@att.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top