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

Programatically increase tetxbox size

P: 157

I have this excel worksheet. As you can se all the rows have different heights based on how much data that is inside the cell. We want to upgrade this worksheet from excel to access, but when we do an import and create a form then all the rows are in the same size, which makes it more difficult to read and less 'user-friendly'

Is it possible to have access mimick the apperance of excel on this type of thing?
May 4 '09 #1
Share this Question
Share on Google+
9 Replies

Expert 5K+
P: 8,679
You can set the Can Grow Property of Text Boxes whose Control Sources are the Fields which you mention = Yes. Now, whenever you Print or Preview the Form (Not Form View), the Text Boxes will expand Vertically to accommodate the Data. I'm not sure this is exactly what you are looking for, but it is worth a mention. Good Luck.
May 4 '09 #2

P: 157
Ok.. It made the case slightly better. Though i am not satisfied :)
May 5 '09 #3

Expert 100+
P: 407
It sounds like you are wanting to view your data on a form with a "Datasheet View". If that is the case, you are quite limited in your approaches.

If you wanted to view your data on a "Single Form" view, you could, using code, count the number of characters in the field, divide by the number of characters that fit in the width of the control to find out how many lines you need. Then you have to figure out how tall a line would be and set the height of the control to that.

This would:
b) be a whole lot of trouble, and
b) would probably necessitate moving any controls below the control being re-sized.

You could just make the control big enough for the biggest entry in that field, but then you get a lot of white space if the field is short. If you make a text box control moderately large and it gets more data than it can show, you can add scroll bars to see the rest.

May 5 '09 #4

Expert 2.5K+
P: 2,653
In few words Access.Form has no such functionality.
  • You could mimic such behavior having form with controls for "several" records changing their size/position depending on content.
  • If you feel happy with interface provided by Excel, then why not to use Excel application as front end?

May 5 '09 #5

Expert 2.5K+
P: 3,532
In point of fact, for Single View forms, Stephan Lebans has already done the grunt work with a hack called CanGrow, available for download at

It mimics the CanGrow property of reports /printed forms.

Linq ;0)>
May 5 '09 #6

Expert 100+
P: 407
Woah, that's way more than I was thinking of. He's even coded a Fudge Factor, I love it when people code a Fudge Factor!

May 5 '09 #7

Expert 2.5K+
P: 2,653
fudge factor (aka control margins) are assumed to 5% from text footprint height

I wouldn't say it is a very clever assumption.
Actually, this part I considered to be the most interesting, since it is not that difficult to calculate text footprint. And, frankly speaking, I'm somewhat disappointed with how real control height is being calculated.
May 5 '09 #8

Expert Mod 15k+
P: 31,709
I'm not a great fan of reprogramming things in one application just so that you can mimic the functionality of another.

I generally see this as a clue to use the application that is already designed to work that way. Excel is quite capable of grabbing data on the fly from an Access back end, but updating that data is less straightforward. This may not be possible for you of course, but is certainly worth consideration at least.
May 6 '09 #9

Expert 2.5K+
P: 2,653
Agree (post #5).
It is not that difficult to use Excel as front-end and there could be different approaches to this varying from export-edit-reimport to synchronizing recordset with spreadsheet in a manner similar to Access.Form.
May 6 '09 #10

Post your reply

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