Home  |  About  |   Search   

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

RunCommand Constants

Terms of Use


 

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-2009, Dev Ashish & Arvin Meyer, All rights reserved. Optimized for Microsoft Internet Explorer