I hope to demonstrate how forms and subforms interact and how joins work. All I have shown is my lack of understanding. Yes, I have been thru the FAQs, the BH49 Base Handbook, BG65 BaseGuide, and more. I know that REFRESH in a SubForm refreshes its parent. Can / how does one refresh the aunt /uncle form?
I could not upload the DB or a .odt of my layout.
Do not understand why you could not upload items. A
zip is understood but can be renamed to .odt and notify all to rename. Don’t see a reason for .odt → edit question and use paperclip icon on toolbar (upper left of question). Also see → How do I attach a file to my question/answer?
Thank you @Ratslinger. The .odb is 1,540KB and I have not been able to get my ZIP to split it. I think that it has HSQLDB_2.3.2 embedded as this is from LibreOFfice-Portable. The Dataabase folder is only 20 KB.
Having not done this in a while, tested again. Took HSQLDB split Base file, made a copy for backup & then renamed extension from .odb to .zip. Opened with an archive manager (linux) and deleted the
driver folder - contains the no longer needed jar files. Closed archive manager & renamed back to .odb - tested all OK. Resulting file went from 1.6mb to 74.3kb. Now the entire split folder can be zipped up, renamed to .odt or .odb, posted and noted to rename back to zip so as extraction will work.
Maybe some day the Ask site will allow posting of .zip files. Until then this has worked.
@Ratslinger, I’ve been tied up with family medical problems all day and will be tomorrow also. I just uploaded New Refresh-1.odb, an embedded version. I conclude that a “Refresh” button at each form level could work, but do not expect that to be intuitive to those who know less of Base than I.
Thank you, @Ratslinger, for the “Having not done this in a while, tested again…” above. I saved those instructions to try when things settle down again. I was very surprised to see the size of the split Base files. I sure expected that would be smaller!
@Ratslinger, You said “As for the query, don’t see any problem there. Don’t understand your questioning it. No data - just NULLs”.
There is no problem there. That is only a note showing that this is an expected result result of a container of NULL.
From notes on form in sample:
UNRELATED TO THIS QUESTION ->(NOW Left_ID 4 and it’s L_match “four”. There is no “four” in the Right Table. At Right_ID the cell is NULL (empty). No primary key is to be shown, but the value is displayed.)<-
That entire form was confusing with all that text. Appears that was part of question. Nothing ever explained or specified.
Do not agree with you statement about refreshing a sub form. This in itself does nothing to the main form.
As for what you call aunt/uncle forms, these are simply just other main forms with no connection to one another. If, for example you add some data to a table through another means (SQL perhaps) and want to refresh the data on that form, a push button on the form will accomplish the task. Place it on the form to refresh and set the
Should also mention, if you are using a Form Navigation toolbar, there is an icon on there to
Refresh the form/sub form/sub sub form/etc (wherever it is pointed at).
The image provided states:
How may I refresh all of these with one button? Thanks.
To accomplish that you need to write a macro. That macro would access each form and/or sub form, one at a time, and then issue a command to refresh that form.
Have copied & cleaned up the form. Added simple macro to reload all forms. One Button.
As for the query, don’t see any problem there. Don’t understand your questioning it. No data - just NULLs.
2nd Edit 2021-04-06:
Here is another sample using no macros; just buttons as I have pushed for all along:
I do understand the above. My opinion is that if I get this to work, the user would not be likely to do this.I’ll check back tomorrow. Thank You, @Ratslinger.
After some sleep and further thought, don’t see a need for you to refresh all the forms as you ask.
The forms directly from tables display and save as data is entered. No need for refresh. The same is true for the sub form. The one form you would need to refresh is the one based upon the query which incorporates join(s). That one only refreshes upon the refresh command - just add a push button there with the appropriate Action.
Now understand what you are referencing with sub form. This is not normal. I would use button there. But as to the request, if all are to be refreshed with a single button, a macro is necessary. Don’t know of another method.
My MainForm is based on the Left Table, its SubForm’s Content type: Table, Content: Right (Table). A SAVED change in the RIGHT TABLE is not always reflected in these forms. (see my last upload)
I desire, on one screen, to show examples of Left, Right, Inner and Cross joins. I believe that I can do this IF I can refresh each, or re-load (close and re-open?) with one button.
Sorry, between the comments in the form (don’t get why - should be part of the question) and your last comment don’t understand where you are with all this.
“To accomplish that you need to write a macro. That macro would access each form and/or sub form, one at a time, and then issue a command to refresh that form.”
I need to find a looooong snorkel as that is way over my head right now.
Button calls macro “Refresh-All”
Variable FormName = form1
Variable FormName = form-n
talk to Sun, and perform magic
I have been trying to get my head around the macros in OpenFormExample.odb from [Example] OpenForm with macros (View topic) • Apache OpenOffice Community Forum
If he can take a value, open a form, use that value and return to the original morm, this can be done!
Another less wordy version of the macro:
Option Explicit Sub refresh_All Dim Form1 as Object Dim oForm as Object Dim oSubForm as Object Form1 = ThisComponent.Drawpage.Forms oForm = Form1.getByName("Left_Table") 'Get Form' oForm.reload() oForm = Form1.getByName("Right_Table") 'Get Form' oForm.reload() oForm = Form1.getByName("Left_Join") 'Get Form' oForm.reload() oForm = Form1.getByName("MainForm") 'Get Form' oForm.reload() oSubForm = oForm.getByName("SubForm") 'Get Sub Form' oSubForm.reload() End Sub
Thank you, @Ratslinger. I copied and pasted this code into Object Catakod [New Refresh-1.odb][Standard][Modual1]. It is called from the button marked “Right Table” on Key Pressed. (Standard.Module1.refresh_All (document, Basic)). I see: “BASIC runtime error. Property or method not found: Drawpage.”.
(a) Where did I goof this time?
(b) If the form with the button gets re-loaded before the next in the list, would that stop the macro, or would it complete?
(c) Can forms be refreshed without reloading?
------ If not, it explains why my searches failed -----
Thank you again.