Report with dynamically changing text box size

AdamSmith

Registered User.
Local time
Today, 14:00
Joined
Jan 29, 2019
Messages
14
Hi Everybody..

Is it possible to have a report with flexible text width and height? I want to change font size based on the length of text. I try this code ON FORMAT but it didn't work:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Len(Me.FName) > 3 Then
Me.FName.FontSize = 5
Else
Me.FName.FontSize = 11
End If
End Sub

see my att
 

Attachments

Hi. What do you mean by "it didn't work?" I downloaded your file and tried it out. It worked for me.
 
thank you theDBguy, but I tried my file on other PC and also the code didn't work.
based on my idea the third record should to appears all letters of "Sara", not only 3 letters, but with smaller font size.
 
It works in Print Preview where the format event is triggered.
It doesn't work in Report view or Layout view as these do not trigger that event.

Whilst it works as intended, IMO it doesn't look good. Why not increase the field width?
 
thank you theDBguy in advance!
I don't notice the code is working in Print Preview.

"Why not increase the field width?"
because I the real file (my Project) has a fixed template
 
My problem now is when I use the command button that export the report to PDF, the code doesn't work unless show the report in "Print Preview" before.
 
Why is that a problem? I always create PDFs from reports in Print Preview
There is no workround that will allow this to work in Report view
 
thank you isladogs..
again I didn't notice the code work also with the command button
 
Have you tried the "can grow" and "can shrink" properties on reports? No code involved and its a easy test. See attached.

attachment.php
 

Attachments

  • Can grow.JPG
    Can grow.JPG
    70.1 KB · Views: 326
Have you tried the "can grow" and "can shrink" properties on reports? No code involved and its a easy test. See attached.

attachment.php

Yes I have.. but the real file (my Project) has a fixed template.

Thanks AccessBlaster
 

Users who are viewing this thread

Back
Top Bottom