Autoresize column widths in Split Forms? (1 Viewer)

jonathanchye

Registered User.
Local time
Today, 13:03
Joined
Mar 8, 2011
Messages
448
Hi,

I have a Split form with the datasheet displayed at the bottom. Is there anyway to force autoresize of column widths everytime form is loaded? Even if I resized once the widths automatically resets again afters...

Thank you.
 

boblarson

Smeghead
Local time
Today, 05:03
Joined
Jan 12, 2001
Messages
32,059
I don't believe you can do that for a split form. If you want that functionality I believe you would need to create a subform and use it like the split form datasheet instead of a regulare split form.
 

jonathanchye

Registered User.
Local time
Today, 13:03
Joined
Mar 8, 2011
Messages
448
well I have some subforms which displays as Datasheet but the columns don't autoresize either. Some of my end users would like Excel like view hence why I am looking for a presentable way of using datasheet view...
 

lution

Registered User.
Local time
Today, 07:03
Joined
Mar 21, 2007
Messages
114
Set the tag to "?" for each of the controls you want to resize and then add the following:


Dim ctl as control

For Each ctl In Me.Controls
If ctl.Tag = "?" Then ctl.ColumnWidth = -2
Next

Put this into the load event for the form and subform.
 

boblarson

Smeghead
Local time
Today, 05:03
Joined
Jan 12, 2001
Messages
32,059
Set the tag to "?" for each of the controls you want to resize and then add the following:




Put this into the load event for the form and subform.
but doesn't work for the datasheet of a split form.
 

grahamvb

Registered User.
Local time
Today, 08:03
Joined
Aug 27, 2013
Messages
57
I had the same problem. What worked for me (Access 2010 Split Form) was to resize all the columns (by dragging the right edge of the column header) the way I wanted, then right click any column header and select "Hide Column." Hide any column, click "Ok" then right click again on any column, choose "Unhide Column" and unhide the one you hid in the first place. Click "Ok" and presto the form opens with the resized column widths every time.
 
Last edited:

jonathanchye

Registered User.
Local time
Today, 13:03
Joined
Mar 8, 2011
Messages
448
I had the same problem. What worked for me (Access 2010 Split Form) was to resize all the columns (by dragging the right edge of the column header) the way I wanted, then right click any column header and select "Hide Column." Hide any column, click "Ok" then right click again on any column, choose "Unhide Column" and unhide the one you hid in the first place. Click "Ok" and presto the form opens with the resized column widths every time.

Designing another database and ran into the same problem. I've tried your method but the changes will not last if I reboot PC or update client.

Same really as Columnwidth = -2 doesn't work on split forms :( I really don't want to create subform just to resize as I want to keep this as simple as possible.


The easiest way to auto resize seems to be 2 mouse clicks - click on top left to select all and double click on the right hand side of a column to autoresize. If it can be done manually I just don't understand why there's no method to do it programmatically!
 

Users who are viewing this thread

Top Bottom