Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2014
    Posts
    26

    AutoFit Text size to display in a form textbox


    has anyone come across any forums or solutions which allows me to have a autofit text in a textbox in a form textbox.

    I would have thought there was some form of logical calculations/ formula/ pattern which text size, font and textbox size correlate to each other, has been devised. Allowing the calculation of textbox size, font and font size to automatically adjust font size to display all text within a textbox. Sane idea as MS Word allows to automatically adjust text size to the size of the textbox.

    In my circumstance it is a text will be short maybe up-to 40 chars but it is displayed significantly large. can grow/shrink is not an option. There has been a few options i have seen on forums but i have not been able to open this applications due to I am running a 64bit office 2013.

    any help would be great.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I would guess that any changes made to the control would have to be performed during Design Time and cannot be done in a pure Run Time environment. So the User would have to have a full version of Access installed on their machine.

    It probably would not be too difficult to build a function that would analyze the length of a string and modify a control based on the result. Maybe pass the name of the form and name of the control to the function or pass the actual control to the function as a control.

    Why are you having trouble opening the examples you are mentioning? You do not have any sample code?

  3. #3
    Join Date
    Jul 2014
    Posts
    26
    I cant remember where the sample database was from but i downloaded it but cannot open it due to it being created on a 32bit office .mdb (pre 2007) database - i am assuming that due to the old structure and/or the version is causing me an issue to open the database in Ms Access 2013 64 bit.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Access 2013 does not like mdb files but you should be able to convert it. Anyway, I would build a Public function within a Standard Module and pass the name of the form and the current control to it. Then, the function could adjust the font size. I would leave the control width alone and have it preset for the maximum width possible. You should be able to adjust the font size during Run Time but I do not believe the control width is available during RT.

  5. #5
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    take a look at this function created by Stephen Leban. http://www.lebans.com/autosizefont.htm

    If you can't open it, let me know and I'll save it as a .accdb

  6. #6
    Join Date
    Jul 2014
    Posts
    26
    Ajax, this is the sample database I have downloaded but cannot open.

    If your able to convert this database it would be greatly appreciated.

  7. #7
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    here you go - click through the different records to see changes in font size
    Attached Files Attached Files

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 02-10-2015, 01:07 AM
  2. Replies: 1
    Last Post: 06-18-2014, 09:39 PM
  3. Replies: 6
    Last Post: 10-01-2013, 10:58 AM
  4. Replies: 3
    Last Post: 08-18-2011, 07:31 AM
  5. Replies: 2
    Last Post: 11-16-2010, 10:55 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums