title: Set and retain column widths of Split Form datasheet columns in MS-Access
body: <p>I'm using a <code>Split Form</code> in Access 2012. Basic datasheet view on top with individual record and form header in bottom pane.</p>
  
  <p>I'm trying to figure if there's a way to keep my column widths to manually sized widths - and ideally, set column widths to BestFit via VBA code when the Form loads.</p>
  
  <p>I have found <a href="http://www.access-programmers.co.uk/forums/showthread.php?t=207123" rel="nofollow">this one hack</a> that remembers the column widths the next time you start.</p>
  
  <blockquote>
    <p><em>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.</em></p>
  </blockquote>
  
  <p>But the problem happens again if I distribute the database.</p>
  
  <p>If I could somehow reference the datasheet view columns object, I could probably apply the BestFit method</p>
  
  <blockquote>
    <p><strong>EDIT - UPDATE: I have tried using this function to no effect:</strong></p>
  </blockquote>
  
  <pre><code>For Each ctl In Me.Controls
     With ctl 
        Select Case .ControlType
           Case acTextBox
              Debug.Print .Name
              If Not .ColumnHidden Then
                 .ColumnWidth = -2
              End If
        End Select
    End With
  Next
  </code></pre>