https://www.access-programmers.co.uk/forums/threads/setting-a-group-of-controls-visible-hidden-or-enabled-disabled.293412/

PHOTO EMBED

Thu Dec 08 2022 09:07:40 GMT+0000 (Coordinated Universal Time)

Saved by @paulbarry

Private Sub SetControls(State As Boolean, Tg1 As String, Optional Tg2 As String, Optional Tg3 As String, _
        Optional Tg4 As String, Optional Tg5 As String, Optional Tg6 As String)

On Error GoTo Err_Handler

    'set controls to visible or not according to the control tag value
    For Each ctrl In Me.Controls
        If ctrl.Tag = Tg1 Or ctrl.Tag = Tg2 Or ctrl.Tag = Tg3 Or ctrl.Tag = Tg4 _
            Or ctrl.Tag = Tg5 Or ctrl.Tag = Tg6 Then ctrl.visible = State
    Next ctrl
  
Exit_Handler:
    Exit Sub

Err_Handler:
    'create error message & log
    strProc = Application.VBE.ActiveCodePane.CodeModule.ProcOfLine(Application.VBE.ActiveCodePane.TopLine, 0)
    PopulateErrorLog
    Resume Exit_Handler
    
End Sub


In the Form_Load event, add code to set the start up properties like this:
	SetControls True, "A"
    	SetControls False, "E", "S", "Q", "P", "V"
    	SetControls False, "F", "FB", "R", "FR", "RB"
content_copyCOPY

Tags

https://www.access-programmers.co.uk/forums/threads/setting-a-group-of-controls-visible-hidden-or-enabled-disabled.293412/