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.
Microsoft Access

Avatar of undefined
Last Comment
Jeffrey Coachman

8/22/2022 - Mon
Dale Fye

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

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Jeffrey Coachman

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...

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy