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 Form?
Answer:
This example illustrated how to cycle trough all the Textbox controls on a form and hides the control if the value is Null.
Code:
Private Sub Form_Current()

    Dim ctl As Control
    
    For Each ctl In Me.Form
        If ctl.ControlType = acTextBox Then
            ctl.Visible = Not IsNull(ctl.Value)
        End If
    Next ctl

End Sub