I have a textbox in a one page ms access report that I have set it to cangrow=no. However I want when the limits are exceeded to dynamically change the font size to smaller. So I need an event that notified me to change the font size to smaller. I dont want to use cangrow=yes because all contents bellow textbox move down to next page. Also this report page will be printed on a pre-printed form with presets places for contents.
Is there a way to grap the grow event of a textbox and to write code based on this? I know that there is not such event in the textbox event tab. But I search for some workaround or if I use windows API.
There is no event for this. What you do instead is:
In the Format
event of the report section, you calculate if the current record's text fits into the given control (textbox usually).
If it doesn't, reduce the font size and calculate again, until it fits.
For single-line controls, this is fairly easy, Access even has the Report.TextWidth method for that.
But usually you need this for multi-line textboxes, for this check Stephen Lebans page here:
https://www.lebans.com/textwidth-height.htm