Results 1 to 3 of 3
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Grouping Controls (A2k AR1)

    I have created a group of controls on a form by selecting the controls I want to group and using the Format Group menu item. The grouped controls do not include all of the controls on the form. On the on open event of the form, I need to disable the controls in the control group but can't seem to figure out how to do this. Is it possible to disable a group of controls using a control group? I am trying to avoid writing the syntax for each and every control as me.control.ebabled = false on the on open event of the form.

    The controls in the group include combo boxes, text boxes, and checkboxes.
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Grouping Controls (A2k AR1)

    AFAIK, grouping controls on a form is only for interactive use - it makes it easier to move a number of controls.

    The easiest way to disable a group of control, of course, is to group them interactively and set their Enabled property to No in design view. That way, they will be disabled initially.
    If you want to have an "easy" way to enable or disable a number of controls in code, you can use the Tag property. For instance, set it to "Dis" (without the quotes) for all controls you want to disable.

    Private Sub Form_Open(Cancel As Integer)
    Dim ctl As Control
    For Each ctl In Me.Controls
    If ctl.Tag = "Dis" Then
    ctl.Enabled = False
    End If
    Next ctl
    Set ctl = Nothing
    End Sub

  3. #3
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Grouping Controls (A2k AR1)

    Thanks Hans. I wish I would have thought of this sooner.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •