Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    145

    Unanswered: variable textbox length

    Hello all, I need to be able to adjust the size of a textbox dynamically. I have used a non-proportional font so a text of a certain length will be the same no matter what letters used. The textbox will be on a report. The way the report works is the user can select which fields will be shown on the report via a form before the report is generate. Right now I have a function outside of the report that determines the longest text for each field being shown. Before I had a hidden label that I filled with the longest text and then did a sizeToFit and then stored the width. I had to open the report in design mode and hidden. It worked perfect except when I made the .mdb into and .mde I couldn't open the report in design view anymore.
    I've tried hardcoding and am not getting very far. For example on the report sometimes the state field only shows one letter, but if I run it on different criteria it shows both letters. It makes no sense. The hardcoded calculation should have made the field the same size both times. I have to pretty exact too since I use every millimeter of the report width for the fields. My specific problem is the last textbox going passed the width of the report. I don't have much extra space to over estimate the needed width.

    So I need a way to determine the exact needed width of the textbox for the longest text in each field of a recordset. Keep in mind the sizeToFit worked perfect so this has been done successfully I just need a way that will work in the MDE. Let me know of any questions, I've kind of rushed through this.
    Thanks for any help.

  2. #2
    Join Date
    Jan 2004
    Posts
    145
    I was mistaken on the hard code. It works. I thought that all my state fields were 2 chars, but on was 3 so that was the difference. I would still like to know how to do this without hardcoding.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •