来自:微软 翻译:周芳
【译文】如果主窗体不包含记录,如何隐藏它的子窗体
下面的例子说明了如果主窗体不包含任何记录,如何隐藏一个命名为Orders_Subform的子窗体。代码写在主窗体的当前事件过程里。
VBA代码:
Private Sub Form_Current()
With Me![Orders_Subform].Form
“检查RecordCount的子窗体。
If .RecordsetClone.RecordCount = 0 Then
“隐藏子窗体。
.Visible = False
End If
End With
End Sub
原文:How to: Hide a Subform if the Main Form Contains No Records
The following example illustrates how to hide a subform named orders_Subform if its main form does not contain any records. The code resides in the main form's Current event procedure.
VBA:
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