Page 1 of 1

[Solved] Showing tables only when needed

PostPosted: Mon Nov 11, 2019 1:26 am
by dreamquartz
Hello All,

I have a Master Form and a related Subform.
In the Subform I am enterering information, directy linked to the Master Form.
I rarely have to enter information in a record as part of the table in the Sub Form.
I do not want to see the record in general, so I want to make the record entry visible when needed.
When shown, I want to see only those records that are related to the ClassID from the Main Form, entered in the Sub Form, but now also the record that needs to filled out.

My attempts only lead to showing the whole table content of table tClassPeople, and not only the filtered one based on tClassID.

In the example there are 2 forms.
The 1st (fGroup1) shows the column Group from table tClassPeople.
I want that column to be hidden, and only shown when needed via e.g. a PushButton that open a Form.

The 2nd (fGroup2) indicates what the Solution could appear to be.

Is there a way of doing something like this?


See attachment

Re: Showing tables only when needed

PostPosted: Mon Nov 11, 2019 5:56 am
by UnklDonald418
Look at the example I uploaded to see if that is what you want.
Changing the EnableVisible property of a table, or the Hidden property on a table column using a Button can only be accomplished by macro.
I modified your Group button on the form document fGroup2 to run one small macro to toggle the EnableVisible property of the table control "tcGroup".
I added another button that toggles the Hidden property for the "nfGroup" column using another macro.

Re: Showing tables only when needed

PostPosted: Tue Nov 12, 2019 9:02 pm
by dreamquartz
Thank you so much.
That is a very elegant solution that works nicely.

Now, you probably know that I am not a fan of macros, so my line of thought was if I could use a button function as to turn on/off a view of a Sub Form, because all the information is in the Sub Form already, and I have no problem to create a new view for the user as where only the Group info is shown as a simple overview as you demonstrated with the "Toggle Group" button.

So as an alternative to your demonstrated solution, is there a way to turn on/off a view of a Sub Form, without a macro?

If need be that a macro needs to be used, it is what it is. The complexity of the things I want to accomplish is leaning more and more to macros ;(.


Re: Showing tables only when needed

PostPosted: Wed Nov 13, 2019 5:16 am
by UnklDonald418
There appears to be only 2 ways to change the visibility properties of a form control,
1) the Properties dialog with the form in the Design mode
2) macro code.
While it is best to avoid macros whenever possible, but there are some situations where they are the best solution.

Re: [SOLVED] Showing tables only when needed

PostPosted: Thu Nov 14, 2019 7:56 pm
by dreamquartz
I concur.

Marking it as SOLVED.