Link to home
Start Free TrialLog in
Avatar of dkaminsk

asked on

Access 2010 SubDatasheet Column Width change

Hi i've got a problem dont know how to change column width in vba to best fit on load of a split form (datasheet part). Help much appreciated.
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

not sure how to do this in a split form, but in a regular datasheet, you could use the form_Load event to change the width, something like:

    Me.Controls("TestText").ColumnWidth = 2880  ' for 2 inches
Avatar of peter57r
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you "Bet Fit" the columns when you open the form, they will be that same width when you reopen the form...

The kicker here is that "Best Fit" only works on the rows "currently visible" on the screen.

So if the longest entry on the screen, (in the last Name field) is "McDonald", the the column will Autofi to display "McDonald"
If you Scroll down and now you see a last name like "Drozdovandropopozgiopanatzakis", ...
Now, the Auto-Fit will need to be reset.

This is the reason why most developers simply set the column to the "Theoretical" largest entry, and just leave it at that...

...Besides, this is one reason why the split form was created....
You can still make the control on the "Form" part of the Split form as large as you like...