Column Widths

  • Thread starter Thread starter James
  • Start date Start date
J

James

I have a subform which is a datasheet linked to a table.
The table only stores data temporarily and it contains
about 140 columns. It only ever uses 15-20 columns most
of the time, is there any way I can set up the subform so
it hides blank columns.
 
It's pretty easy to hide a column in a datasheet.

ControlName.ColumnHidden = True

A good trick is to name the controls in a way that allows you to Loop
through them Programmatically. For instance if you name your controls
something like txtField1, txtField2, txtField3, etc. You can loop through
them as though they were an array of controls.

For i = 1 to 10
me("txtField" & i).ColumnHidden = True
Next

Access does not support real control arrays, but this method is the next
best way. Once you have this set up, all you need to know is what is the
first control that doesn't need to be displayed is, and the max num of
controls on the form.

Ron W
 
Cheers Ron,

that along with a search through the recordset finding no
data hides the blank rows, takes it's time with 140
columns and a few thousand rows, but it does the trick.

James
 
Back
Top