By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,896 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,896 IT Pros & Developers. It's quick & easy.

Automatically resize textbox height to fit contents on form

P: 63
In Access 2007, I'm using bound textboxes on a continuous form to display the contents of each record's memo field. Is there a way to automatically adjust the textbox height to fit the contents?

Thanks in advance.
Dec 24 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 3,532
No, there is no way to "automatically" do this. I think it would require some rather complicated code, wherein you figure, given your font size and width of your memo field's textbox, how many characters could fit in a line, how many lines you need and set the height accordingly. And after doing all this, on a Continuous form, when you change the height of the textbox on RecordA, the height of the textbox on all records would be changed!

A better solution would be to allow the user to expand the textbox on a given record, using the acCmdZoomBox command. You could use this in a number of events, but the DoubleClick event is frequently used

Expand|Select|Wrap|Line Numbers
  1. Private Sub YourControl_DblClick(Cancel As Integer)
  2.   DoCmd.RunCommand acCmdZoomBox
  3. End Sub
as well as the GotFocus event.
Expand|Select|Wrap|Line Numbers
  1. Private Sub YourControl_GotFocus()
  2.   DoCmd.RunCommand acCmdZoomBox
  3. End Sub
Welcome to Bytes!

Linq ;0)>
Dec 25 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.