DJRhino1175
I do want the subform to show all the time, just one line for a new entry.
Normally, new question new thread; however, in this case I think this is really a refinement of what your actual problem was...
OK,
Because you really intended to have the subform show all of the time I really advise simply removing of the calls to the
Function ReSizeForm
.
HOWEVER, if you really want to use the function then we can simplify things a bit
We'll remove the optional new record flag and set a minimum subform height.
So you now have:
Form: Frm_FrmLine - On_Current Event:
- Private Sub Form_Current()
-
-
Call ReSizeSubform(frm:=Me)
-
-
End Sub
and change the function so that you have:
Module: MDLForms - Function ResizeSubform:
- Function ReSizeSubform(frm As Form)
-
' Runs on the OnCurrent of the MAIN Form (FrmLine)
-
Dim TotalHeight As Single
-
Dim NoRecs As Long
-
'
-
With frm.subfrmDrawing.Form
-
If Not .Recordset.EOF Then
-
.Recordset.MoveLast
-
NoRecs = Nz(.Recordset.RecordCount) + 1
-
If NoRecs > MaxRecs Then
-
NoRecs = MaxRecs
-
' .ScrollBars = 0 ' Show scrollbar
-
' Else
-
' .ScrollBars = 0 ' end if
-
End If
-
TotalHeight = .Section(acHeader).Height + .Section(acFooter).Height + (.Section(acDetail).Height * NoRecs)
-
If Not .Recordset.BOF Then
-
.Recordset.MoveFirst
-
End If
-
End If
-
End With
-
'
-
If TotalHeight < 2415 Then TotalHeight = 2415
-
'
-
frm.subfrmDrawing.Height = TotalHeight
-
frm.Repaint
-
End Function
Line 24, ensures that the subform is always shown regardless of the actual number of child records associated with parent.
Again, the value of 2415 for the subform height is an arbitrary value I used because the 4 record subform was aesthetically pleasing to my eye as I stepped through the records.