下面的示例说明当名为 Orders_Subform 的子窗体的主窗体不包含任何记录时如何隐藏该子窗体。 这些代码存放于主窗体的 Current事件过程中。
代 码:
Private Sub Form_Current()
With Me![Orders_Subform].Form
' Check the RecordCount of the Subform.
If .RecordsetClone.RecordCount = 0 Then
' Hide the subform.
.Visible = False
End If
End With
End Sub