Automatic Datasheet Columns Width (1 Viewer)

Bunga2017

Registered User.
Local time
Yesterday, 16:20
Joined
Mar 24, 2017
Messages
19
Please help, I set the new columns width in Datasheet view, then I save and close it. but after re-open the Form in Datasheet mode, the columns width (all columns) returned to previous amount !!
What is the solution (with VBA Code Access 2010)
for set "ALL columns width"
in "Best Fit"
due to load a form
(especially in datasheet view)??

Many thank you
 

CJ_London

Super Moderator
Staff member
Local time
Today, 00:20
Joined
Feb 19, 2013
Messages
16,653
datasheet view uses different properties. For continuous forms you make use of the control width property. In datasheet view it is the control columnwidth property.

for datasheets, in the form load event use the following code

Code:
dim ctrl as control
for each ctrl in me.controls
    on error resume next 'control does not have a columns width property, so move on
    ctrl.columnwidth=-2 '-2 equivalent to double clicking on the column header right edge
next ctrl

not sure what you mean by 'best fit'.
 

Bunga2017

Registered User.
Local time
Yesterday, 16:20
Joined
Mar 24, 2017
Messages
19
Wat I Mean about " Best Fit " is zie attachments !
 

Attachments

  • Best Fit.JPG
    Best Fit.JPG
    28.2 KB · Views: 332

CJ_London

Super Moderator
Staff member
Local time
Today, 00:20
Joined
Feb 19, 2013
Messages
16,653
I don't have that version of access. Suspect it is the same thing I was suggesting. Try it and see
 

Users who are viewing this thread

Top Bottom