SubForm Control

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi Folks - I have a subform control that displays related records.
Typically, there are 1-4 related records per master record. When the subform
has only one record, the subform control displays a lot of "gray space". If
it has two records, it displays a little "gray space". If 3 records, it
looks great. If 4 records, I get a vertical scroll bar.

Is there a way to get the subform control to shrink and grow with the number
of records? Currently, the subform control has Can Grow and Can Shrink set
to yes. Thanks.

Michael
 
The Can Grow and Can Shrink are only used for printing. You might be able to
adjust and use code like:

Dim intHeightOfOne As Integer
Dim intNumRecords As Integer
intHeightOfOne = 360
intNumRecords = Me.sfrmEmployeesDS.Form.RecordsetClone.RecordCount
MsgBox intNumRecords
Me.sfrmEmployeesDS.Height = intNumRecords * (intHeightOfOne + 2)
 
Back
Top