Auto resize the datasheet form (1 Viewer)

gstylianou

Registered User.
Local time
Today, 11:39
Joined
Dec 16, 2013
Messages
357
Good evening,

I would like to ask if there is a way in a Datasheet View form the colums can automatically resize depending on the data available. I tried many solutions but unfortunately I didn't found any way.....

I will appreciate any help

Thanks
 

Ranman256

Well-known member
Local time
Today, 04:39
Joined
Apr 9, 2015
Messages
4,337
if you open a datasheet alone, it will resize itself.
if you open a sheet IN a form, then youd have to resize it to the form, for the screen displaying it.
Code:
sub form_resize()
  child.width = me.width -10
  child.height = me.height -20
end sub
 

gstylianou

Registered User.
Local time
Today, 11:39
Joined
Dec 16, 2013
Messages
357
Hi Ramman,

It doesn't work..! Actually its not what i ask to do. I need to resize the column width...
 

speakers_86

Registered User.
Local time
Today, 04:39
Joined
May 17, 2007
Messages
1,919
There is a value you set the width to which tells Access to automatically size it based on the data. I believe the value is -1 or -2. I don't remember.
 

JHB

Have been here a while
Local time
Today, 10:39
Joined
Jun 17, 2012
Messages
7,732
It is -1 for Autoresize depending of the data width.
-2 is for Autoresize depending of the control label width.

Code:
Private Sub Form_Load()
  Me.YourControlName.ColumnWidth = -1
End Sub
 

Users who are viewing this thread

Top Bottom