Home  |   French  |   About  |   Search  | mvps.org  

What's New
Table Of Contents
Credits
Netiquette
10 Commandments 
Bugs
Tables
Queries
Forms
Reports
Modules
APIs
Strings
Date/Time
General
Downloads
Resources
Search
Feedback
mvps.org

In Memoriam

Terms of Use


VB Petition

Forms: Hide a subform if no records present

Author(s)
Dev Ashish

(Q)    How can I hide a subform if it doesn't contain any records?

(A)    Modify and place the following code in the OnCurrent Event of the main form.

'*********** Code Start **********
Private Sub Form_Current()
    With Me![SubformName].Form
        .Visible = (.RecordsetClone.RecordCount > 0)
    End With
End Sub
'*********** Code End **********

© 1998-2010, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer