how to AUTOFIT columns

florida2001

New member
Local time
Today, 11:46
Joined
Apr 4, 2014
Messages
4
Does anyone know how to AUTOFIT columns in Access (2013)
thx
 
I assume you are using a datasheet form in which case I presume it will be the same in 2013 as previous versions - you need to refer to the columnwidth property for each relevant control and set it to -2. Note that relevant controls are textboxes and comboboxs - not sure about listboxs and checkboxes etc - try it and see. Also the columnhidden property needs to be false

put something like this in your form load event (not the open event, the recordset may not be loaded)

Code:
dim ctrl as control
 
for each ctrl in me.controls
   if ctrl.controltype=acTextBox 'you'll need to extend this to other control types such as comboboxes
       ctrl.columnwidth=-2
   end if
next ctrl
 

Users who are viewing this thread

Back
Top Bottom