Logo

My Access Tips for Custom Microsoft Access

Application Development

by Matthew V Carmichael


Need Help?

My Tips


Links

Resources
Quick Tip Details
Question:
How do I cycle through all the controls on a Report?
Answer:
This example illustrated how to cycle trough all the Textbox controls on a Report and hides the control if the value is Null.
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim ctl As Control
    
    For Each ctl In Me.Report
        If ctl.ControlType = acTextBox Then
            ctl.Visible = Not IsNull(ctl.Value)
        End If
    Next ctl

End Sub