[Solved] Showing tables only when needed

Discuss the database features

[Solved] Showing tables only when needed

Postby dreamquartz » Mon Nov 11, 2019 1:26 am

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?

Dream

See attachment
Attachments
Group.odb
(22.19 KiB) Downloaded 5 times
Last edited by dreamquartz on Thu Nov 14, 2019 7:55 pm, edited 1 time in total.
LO 6.x and OO 4.x on Windows 7 PRO & Ubuntu 18.04 LTS.
dreamquartz
 
Posts: 715
Joined: Mon May 30, 2011 4:02 am

Re: Showing tables only when needed

Postby UnklDonald418 » Mon Nov 11, 2019 5:56 am

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.
Attachments
Group01.odb
(24.38 KiB) Downloaded 9 times
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1256
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Showing tables only when needed

Postby dreamquartz » Tue Nov 12, 2019 9:02 pm

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 ;(.

Dream
LO 6.x and OO 4.x on Windows 7 PRO & Ubuntu 18.04 LTS.
dreamquartz
 
Posts: 715
Joined: Mon May 30, 2011 4:02 am

Re: Showing tables only when needed

Postby UnklDonald418 » Wed Nov 13, 2019 5:16 am

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.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1256
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: [SOLVED] Showing tables only when needed

Postby dreamquartz » Thu Nov 14, 2019 7:56 pm

I concur.

Marking it as SOLVED.

Dream
LO 6.x and OO 4.x on Windows 7 PRO & Ubuntu 18.04 LTS.
dreamquartz
 
Posts: 715
Joined: Mon May 30, 2011 4:02 am


Return to Base

Who is online

Users browsing this forum: No registered users and 3 guests