Adjust size of text box automatically

G

Guest

I was wondering if it's possible to adjust the size of a text box
automatically to accomodate the amount of text. This would be done in form
view.

Basically I have a subform where notes are stored. The text box is set to
memo field but it cuts off after 255 characters. The sub-form is in
continuous form as well.

I'm using Access 2003.

Please help!
 
V

Van T. Dinh

255 length is fairly special ... The first thing I would suggest is to check
the DatsheetView of the RecordSource (usually a Query or an SQL String) of
the Subform and see if the notes are returned in full by the RecordSource
first. If the DatasheetView only show 255 characters, then the problem is
in the RecordSource.

This tends to happen if you use a Total Query / SQL, i.e. a Query with the
GROUP BY clause ...
 
G

Guest

I viewed this form in datasheet view and all of the notes appear.

I think the problem lies in the fact that my text box is not large enought
to accomodate all of the text. The width is 5.54cm and the height is 2.545cm.
If I write a note that is 50 characters, there will be white space between
the end of that line and the beginning of a new note (that is a new record)
since this form is in continuous form. If I were to adjust the length to
10cm, there would be way too much white space between notes.

What I need to do is be able to automatically adjust the text box size to
accomodate the number of characters. If I type in 50 characters worth of
notes, the text box would shrink to accomodate that number. If I type in 1000
characters worth of notes, the text box would expand vertically to accomodate
that number.

I'm assuming there is a code to do this, I just don't know what it is. I
know for reports you can use the Can Grow and Can Shrink properties but in
form view you cannot.
 
R

Ron2006

Typically the vertical scroll bar is set to yes to allow you to scroll
up and down in the field.

On a true report format you can have the field adjust to the size of
the data, but I do not recall ever seeing it done for forms.

I have multiple apps with the situation you described (memo field
notes) and have not encountered the problem. And I have the user use
the scroll bar to scroll through the data.

Ron
 
G

Guest

I guess that is the simplest answer. I just don't understand why these
properties would not work in form view. I've since using access, a lot of
things don't make sense. Oh well!

Thanks for the help.
 
V

Van T. Dinh

Yes, Even though the TextBoxes (on Forms) have the Properties CanGrows /
CanShrink, these only work when you print the Form (which most of us don't
print Forms).

The simplest is to size the TextBox to the size that show X.5 number of
lines (the .5 is to signify to the user more text to follow) and set the
Property Vertical (Scrollbar) to Yes / True.

Alternatively, you can try Stephen Lebans' autosize_textbox from:

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

Guest

I've tried to access his instructions before but when I open the database it
says read-only...
 
V

Van T. Dinh

That's fine. It may be in A97 file format.

You can open read-only to see the demo Form or you can convert the database
to your default database format.

Either way, you can open the code window to see Stephen's technique / code
in the Form_Current Event.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top