Datasheet autosize through code

  • Thread starter Charles D Clayton Jr
  • Start date
C

Charles D Clayton Jr

I have a subform that is in datasheet view that is linked to a
listbox. For each item in the list box, the subform will show its BOM
(Bill of Materials). It would be nice if each column would resize
itself to a bestfit. That way I could make maximum use of my space.
Is there a way to set this up automatically?

Thanks,

Charles D Clayton Jr

Running A2K
 
D

david epsom dot com dot au

Sub gsbBS_AutoFit(f As Form)
'2003/03/16 dlg from BK
Dim intField As Integer

For intField = 0 To f.Count - 1
If not (TypeOf f(intField) Is Label) Then
f(intField).ColumnWidth = -2
End If
Next

End Sub

(david)
 
C

Charles D Clayton Jr

David I appreciate your code but which event do I put it in? Do I put
it in the events for the listbox or for the subform?

Thanks,

Charles D Clayton Jr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top