Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grouping controls together on an Access form

I have an Access2003 form where I wanted to group several controls together and change visibility programatically, though VBA code.

Is this possible? I do know that I can group items through Format -> Group, but if I do that, how do I refer the the entire group in my code?

Thank you

like image 382
zohair Avatar asked Nov 30 '22 11:11

zohair


1 Answers

You could place all the controls in a group box control then change the visibility of the group box itself.

You could also add a value in the tag property of each control you want to group, then in VBA loop through the control and check for that value and change the visibility there.

Set the tag property of all the controls you want to group to something like groupABC or whatever you wish.

Then somewhere in your code use this to loop through the form controls and check for it.

Dim ctrl As Control
For Each ctrl In Me.Controls
    If ctrl.Tag = "groupABC" Then
        ctrl.Visible = False
    End If
Next
like image 127
Joel Gauvreau Avatar answered Dec 04 '22 09:12

Joel Gauvreau