Ask Your Question

Refresh - reload SAME LEVEL forms, or suggest a better way?

asked 2021-04-06 03:22:58 +0200

FKlusmann gravatar image

updated 2021-04-07 01:10:58 +0200

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?

LibreOffiePortable (x86) Windows 10.0 Split_HSQLDB_2.3.2_Wizard_v3d AdoptOpenJDK 11.0.10
FormC:\fakepath\MyForm-2.gifC:\fakepath\New Refresh-1.odb

edit retag flag offensive close merge delete



FKlusmann gravatar imageFKlusmann ( 2021-04-06 03:44:21 +0200 )edit

I could not upload the DB or a .odt of my layout. :(

FKlusmann gravatar imageFKlusmann ( 2021-04-06 03:46:59 +0200 )edit


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?

Ratslinger gravatar imageRatslinger ( 2021-04-06 03:54:44 +0200 )edit

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.

FKlusmann gravatar imageFKlusmann ( 2021-04-06 05:02:17 +0200 )edit


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 gravatar imageRatslinger ( 2021-04-06 22:56:01 +0200 )edit

@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.

FKlusmann gravatar imageFKlusmann ( 2021-04-07 01:19:08 +0200 )edit

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!

FKlusmann gravatar imageFKlusmann ( 2021-04-07 01:26:39 +0200 )edit

@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.

FKlusmann gravatar imageFKlusmann ( 2021-04-08 00:21:59 +0200 )edit

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.

Ratslinger gravatar imageRatslinger ( 2021-04-08 00:32:41 +0200 )edit


FKlusmann gravatar imageFKlusmann ( 2021-04-08 00:43:49 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-04-06 04:05:05 +0200

Ratslinger gravatar image

updated 2021-04-07 04:23:17 +0200


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 Action to Refresh form:

image description


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).

Edit #2:

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.

Edit 2021-04-06:

Have copied & cleaned up the form. Added simple macro to reload all forms. One Button.

Sample-------- NewRefresh.odb

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:

Sample--------- AnotherNewRefresh.odb

edit flag offensive delete link more


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

FKlusmann gravatar imageFKlusmann ( 2021-04-06 05:10:45 +0200 )edit


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.

Ratslinger gravatar imageRatslinger ( 2021-04-06 18:55:43 +0200 )edit


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.

Ratslinger gravatar imageRatslinger ( 2021-04-07 01:31:58 +0200 )edit


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.

FKlusmann gravatar imageFKlusmann ( 2021-04-07 01:46:03 +0200 )edit

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.

Ratslinger gravatar imageRatslinger ( 2021-04-07 01:55:44 +0200 )edit

From above: "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" Sub Refresh-All Variable FormName = form1 CallSub RefreshForm Variable FormName = form-n CallSub RefreshForm End Sub Sub ReFreshForm talk to Sun,,,,, and perform magic End Sub

I have been trying to get my head around the macros in OpenFormExample.odb from

If he can take a value, open a form, use that value and return to the original morm, this can be done!

FKlusmann gravatar imageFKlusmann ( 2021-04-07 02:24:42 +0200 )edit

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 = Form1.getByName("Right_Table") 'Get Form'
    oForm = Form1.getByName("Left_Join") 'Get Form'
    oForm = Form1.getByName("MainForm") 'Get Form'
    oSubForm = oForm.getByName("SubForm") 'Get Sub Form'
End Sub
Ratslinger gravatar imageRatslinger ( 2021-04-07 03:10:31 +0200 )edit

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.

FKlusmann gravatar imageFKlusmann ( 2021-04-07 21:58:56 +0200 )edit


There is no indication as to where you placed the code you pasted. You notes are meaningless without the files. I have presented to you two working samples with the code. Is your code in the same place? It needs to be in the document and not in My Macros & Dialogs. Chapter 9 of the Base manual does present some information on libraries & locations. Macros are much more involved than just Base. Having trouble with Base is a sure sign you will have much much problems with macros - even the simplest.

The only thing a reload does is to reload the data. The button will not stop it. Forms (actually its data) get reloaded. Sometimes there is refreshing in a control.

Ratslinger gravatar imageRatslinger ( 2021-04-07 22:51:29 +0200 )edit

(Commenting under Answer) I do not understand why I see your replies out of order. Then, it seems that I reply in the wrong places.

I refer to Quick-n-dirty_NO_MACRO.

Fill all Left_Table matches, zero thru five. Close and re-open the form. Selecting records in the MainForm, the SubForm shows the expected results. Now, select MainForm Left_ID 3. Delete L_match at Left_ID 3. Button [Refresh Join] works. Button [Refresh Sub Form] does not reflect the change.

The MARCO form works great!

I Copied the macro from here, pasted over "mine" in my form (after fixing the Left_Form name), and that works well.

Thank you again, @Ratslinger

FKlusmann gravatar imageFKlusmann ( 2021-04-08 00:08:28 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-04-06 03:22:58 +0200

Seen: 36 times

Last updated: Apr 07