locked
Grouping and Arranging Controls in Access on a form RRS feed

  • Question

  • I have a form that will have 4 groups of controls, with each a combo box, a control button and a couple labels. I have a listbox (multiselect) where each listitem corresponds to a group so that it will show if selected

    Depending on which rows in a listbox are selected, I would like to show and vertically arrange each group of controls where the selected sections are visible and the unselected groups are hidden

    I was thinking of using tabs, but the requirement is to have all groups visible on one screen.  I could use tags for each group, but was wondering if there was a container that I could put the controls in and just toggle the visible properry of the container, as well as the top and left property, based on the list items selected.

    Tuesday, April 21, 2020 6:04 PM

Answers

  • I was thinking of using tabs, but the requirement is to have all groups visible on one screen.  I could use tags for each group, but was wondering if there was a container that I could put the controls in and just toggle the visible properry of the container, as well as the top and left property, based on the list items selected.

    Hi JHarding,

    Whatever systematics you want to use to add flexibility to forms, you will have to take the management in your own hands, and it means that you need to program this by yourself. So in line with Tom, think twice if you really need this, and if you really like this.

    But it is absolutely doable. My favourite way is to use subforms with predefined hidden controls that can be tuned in any way, with respect to position,, size, colour, behaviour, etc, etc. As far as I understand your question I guess it is not too complicated.

    For myself I went a few steps further with this systematics. My applications now consist of many completely dynamical "forms" using one main form, that contains one or many of the same subforms. This combination is used in 100+ completely different applications. It adds enormous flexibility to the applications.

    Imb.

    • Marked as answer by JHarding08 Friday, April 24, 2020 7:41 PM
    Wednesday, April 22, 2020 8:17 AM

All replies

  • You could use a subform, and put it on the form four times. Not sure it's worth the hassle. I would rather have names ending in 1, 2, 3, or 4, and loop over the form's Controls collection, inspect the names, and turn Visible on or off.

    -Tom. Microsoft Access MVP

    Tuesday, April 21, 2020 7:37 PM
  • I was thinking of using tabs, but the requirement is to have all groups visible on one screen.  I could use tags for each group, but was wondering if there was a container that I could put the controls in and just toggle the visible properry of the container, as well as the top and left property, based on the list items selected.

    Hi JHarding,

    Whatever systematics you want to use to add flexibility to forms, you will have to take the management in your own hands, and it means that you need to program this by yourself. So in line with Tom, think twice if you really need this, and if you really like this.

    But it is absolutely doable. My favourite way is to use subforms with predefined hidden controls that can be tuned in any way, with respect to position,, size, colour, behaviour, etc, etc. As far as I understand your question I guess it is not too complicated.

    For myself I went a few steps further with this systematics. My applications now consist of many completely dynamical "forms" using one main form, that contains one or many of the same subforms. This combination is used in 100+ completely different applications. It adds enormous flexibility to the applications.

    Imb.

    • Marked as answer by JHarding08 Friday, April 24, 2020 7:41 PM
    Wednesday, April 22, 2020 8:17 AM
  • I was thinking of using subforms, that way I would have a container of some kind so it would be one call, but I need to stack them, but could do that programmatically. I have a multiselect lstbox that determines what is shown or hidden.

    Each group of controls has a label, combobox, button and a frame. I can use the tag methodology, but it would still be showing/hiding each control, then setting the top/left for each. At least with a subform, the group's controls are set, just need to set the subforms top/left

    Or is there a way to include all the control groups in one subform and then show/hide groups based on values in like a continuous form? then the vertically arranging would be done automatically

    The multiselect list box has 2 columns ID and Requested Work, there are currently 5 rows to choose from

    For each requested work there is a group of controls that would show if selected. I currently have one table that has all the fields for the controls, since its 1:1 with the parent form

    I might just try the subforms.

    Thursday, April 23, 2020 7:14 PM
  • Or is there a way to include all the control groups in one subform and then show/hide groups based on values in like a continuous form? then the vertically arranging would be done automatically

    Hi JHarding,

    You can do some re-thinking.

    Instead of using 4 or 5 subforms that represent the different possibilities, can you have only ONE subform that is tuned to the current selection of the user?

    Imb.

    Thursday, April 23, 2020 8:37 PM