Results 1 to 5 of 5
  1. #1
    daltman1967 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jul 2011
    Posts
    18

    Auto size text

    I have a control on a report that is a fixed width, due to the page size. I want to automatically size the text to fit within the control named 'AName1' (which is a label) so that ALL of it is visible. Centering horizontally is easy, but I'd also like the text to be centered vertically.

    Now, I already tried a "if len(d)=10 then AName1.FontSize = 28" type of structure, but a) it's clunky b) it doesn't work every time. Any ideas?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,628
    Don't know any way to do that. Also, there is no vertical center parameter. Must set the TopMargin property to adjust vertical position. The textbox CanGrow property is intended to handle data of unknown length. The data will wrap to multiple lines. I presume you are trying to avoid this. I have encountered this issue before and had to accept the multi-line.
    Last edited by June7; 01-30-2012 at 04:10 PM. Reason: change 'horizontal' to 'vertical'
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    daltman1967 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jul 2011
    Posts
    18

    auto size

    I centered the control when I made it, so that took care of horizontal. I know the "Can Grow," but I HAVE TO avoid the multi line. As far as the top margin, since I don't know what it SHOULD be, how could I possibly set it? I'm sure it would have something to do with the text height.

    What I'd like to do, if possible, is to measure the text height & width.

    If the width is greater than the box, shrink it. Then, based on the height, I can set the top margin.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,628
    Sorry, I meant there is no VERTICAL center property. What you are attempting is outside my experience. I wouldn't even try to program this. Calculating text width would not be practical with proportional fonts. Which is probably why you have inconsistent results with present code. I have accepted the CanGrow or arranged record fields to display on more than one line. Also, I have set textbox to non-proportional font (like Courier) then set box width to fit the maximum characters allowed for that field at the font size setting.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    daltman1967 is offline Novice
    Windows 7 32bit Access 2010 64bit
    Join Date
    Jul 2011
    Posts
    18

    fonts

    For me, it is impossible to have data on more than one line. As far as Courier goes, I'm leaving that as a last resort.

    I'm printing a 2/3" x 3 7/16" label, single line. The program that comes with the labeler automatically fits the font to the label; it MAY be possible for me to access it through ODBC programatically; if so, then I'll let IT solve the problem of autosizing the text (which it does perfectly). However, I've been printing the label directly through access, which is why I was asking the question.

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

Similar Threads

  1. Replies: 15
    Last Post: 04-01-2011, 11:41 AM
  2. Import Text File Size Limit
    By wfbp in forum Import/Export Data
    Replies: 1
    Last Post: 11-04-2010, 09:05 AM
  3. Auto fill-in text box on forms
    By windwardmi in forum Forms
    Replies: 7
    Last Post: 09-13-2010, 02:47 PM
  4. Replies: 1
    Last Post: 04-29-2010, 05:15 PM
  5. Auto Formatting Text in a Form
    By swicklund in forum Access
    Replies: 0
    Last Post: 07-23-2009, 01:15 PM

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