I see that you've marked this thread '
Solved' so I presume you're happy with Villeroy's solution. That's excellent.
With reguard to your follow-up question about List Boxes, I presume from your response above that you're simply expressing an
interest in the *ooBasic macro language or underlying UNO API -- in general --
because you're an experienced C++ programmer. I'll offer you some links (below) as food-for-thought on the topic, but I don't recommend learning anything about macros or objects in pursuit of an automated solution to your List Box question.
Concerning your List Box question: I assumed that you had tested the push-button solution with a List Box, so I offered the additional macro-driven solution in response.
The macro was offered as a plug-in solution requiring no additional knowledge beyond built-in Base facilities. In other words, the manual push-button solution requires you to dive under-the-hood to assign an appropriate form-refresh 'action' while also placing the button on the appropriate SubForm using the
Form Navigator. Likewise, a boilerplate macro requires you to copy&paste the macro to your Base (.odb) document, assign the macro to the designated 'event' on the Events tab of the List Box, and ensure the macro code reflects the correct SubForm 'name' as reflected in the Form Navigator. That's it. There's no intent to drive you into actual coding in a case like this. For example...
Given the following macro from the
demo file:
- Code: Select all Expand viewCollapse view
Sub RefreshForm (oEvent as Object) 'Form > List Box > Events > Execute action
oForm = oEvent.Source.Model.Parent
oEvent.Source.Model.commit() 'save the List Box selection to the host data-Form
'save all changes to the MainForm's Table... compiler bug doesn't allow comments on an IF-THEN-ELSE line
IF oForm.isnew THEN oForm.insertRow() ELSE oForm.updateRow()
oForm.GetByName("SubForm1").reload 'reload the SubForm's individually to avoid jumping to the first record
oForm.GetByName("SubForm2").reload 'reload the SubForm's individually to avoid jumping to the first record
End Sub
Your task is to:
1. copy this macro to your Base (.odb) file as shown in the demo (.odb) file
2. assign the macro to the event indicated in the macro comment: Form > List Box > Events tab > Execute action
3. replace the name of your SubForm as appropriate in the macro code; your SubForm name is determined by opening the Form Navigator
4. delete the last line of the macro if you don't have multiple SubForms to refresh
So your macro will likely become:
- Code: Select all Expand viewCollapse view
Sub RefreshForm (oEvent as Object) 'Form > List Box > Events > Execute action
oForm = oEvent.Source.Model.Parent
oEvent.Source.Model.commit() 'save the List Box selection to the host data-Form
'save all changes to the MainForm's Table... compiler bug doesn't allow comments on an IF-THEN-ELSE line
IF oForm.isnew THEN oForm.insertRow() ELSE oForm.updateRow()
oForm.GetByName("SubForm").reload 'reload the SubForm's individually to avoid jumping to the first record
End Sub
The only change is the SubForm name ("SubForm") and elimination of the last line as necessary. Actually, "SubForm" is the default name assigned by the Base Form wizard, so you'll find the exact final code above in many of my demos. I simply failed to point you to one of those demos in this case, so slight modification became necessary.

That would have eliminated steps 3 & 4 above -- leaving a relatively simple, 2-step process similar to that of implementing a push-button.
As promised, some food-for-thought on macros. Note that [url=[Tutorial]Introduction into object inspection with MRI]object inspectors[/url] are available as add-ons or extensions: