Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2002
    Posts
    44

    Unanswered: How do I create a variable sized text box control

    I am designing a database, where I need users to answer questions that are created by an administrator.

    So I am designing a standard response form which displays the question at the top of the form, and then an area for the response.

    The only problem, is that the question could be a few words long, or several paragraphs long.

    I tried setting the "CanGrow" property, but then I realized that it only applies to the form when it is printed.

    Is there a way to create a form that has a locked text box on it which will automatically grow when the form is loaded to be big enough to display the entire question without scrolling?



    This is really frustrating for me, thanks.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Have you tried the height property ?

  3. #3
    Join Date
    Apr 2002
    Posts
    44
    I can modify the height property when the form opens, however, there are two problems with this

    1) I don't know how to determine how high the box needs to be...it is all dependant on how much text is in the memo field of the database

    2) growing the height would cause the text box to overlap the rest of the controls on the page.

  4. #4
    Join Date
    Dec 2001
    Posts
    79
    This link should help:

    http://www.lebans.com/autosize_textbox.htm

    Hope this helps,
    Peter De Baets
    Peter's Software - Microsoft Access Tools for Developers
    http://www.peterssoftware.com

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    1. You will have to test this as each font has its own effective size. Also, are cr/lf in the memo field or is it just straight text ? You will have to use the current width and see how many characters fill that width to get your size per character.

    2. You know the closest control to the text box. So you know its top value. Use this value combined with the text box's top value and height value to prevent overlap.

    If you need additional help, let me know.

  6. #6
    Join Date
    Apr 2002
    Posts
    44
    What you are essentially talking about is "brute-forcing" a formula to resize the entire form during the OnOpen event.

    I had considered this. I was hoping there was an easier way, but I guess not.

    However, during my experimentation, I have run into one problem. I can't seem to successfully resize the main window when it opens. I have auto-size turned on, I have tried setting the Details.Height during OnOpen, but no matter what I do, I can't seem to make the form window any larger than whatever size it was when I designed it with the visual editor.

    Any suggestions/ideas?

  7. #7
    Join Date
    Feb 2002
    Posts
    2,232
    Not the form - just the textbox. Do you need an example ? Can you post a snapshot of your form ?

  8. #8
    Join Date
    Apr 2002
    Posts
    44
    I have just been doing some basic experimentation.

    I understand what you are saying about changing the height of the textbox, and then recalculating the position of all of the other controls on the form.

    The problem I was having proceeding with this theory, is say that when everything is the smallest it would be (1 line tall) the detail section of the form is approx 1" high, thus the form opens up in a small window, almost like a dialog box.

    When I expand the height of the textbox during the onOpen event, though, I cannot get the size of the form window to change at all, it always opens about the size of a dialog box and then I have to either manually enlarge or maximize it.

    Does that make sense?

Posting Permissions

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