Transferring fields between forms - automation

A couple of years ago I have been trying to understand a purpose for an option on a base form described in this article. I finally got a chance to get back to it, and I stripped the original example down to bare bones, so that I can grasp the idea behind it.

I am attaching an example which has an outer form, which holds four inner forms. Two forms which perform the task utilizing two buttons (action for both: reload) - a copy from the aforementioned article, and the other two are my attempt to eliminate the buttons. The idea is for the latter to fire an event and reload the two inner forms. But it does not work. I know perfectly well how to do it with utilization UNO API XStatement interface, but I wonder if this little hidden feature could also be automated in a simpler manner.

Thank you in advance for any suggestions and pointers.
testAddRecord.odb (14.6 KB)

marus_b,
I have kept your manual method, added a fully automated method, added a semi automated method.
the fully automated and semi automated inner forms which contain the list boxes are add only.
the fully automated and semi automated inner forms which contain the table controls are read only.
.
although the semi automated method requires an extra click I suggest it is superior because it allows the user to UNDO a mistakenly selected list box item.
.
I added 3 macros to Module 1:
FullyAutomated fired by list box in ‘Fully automated method’ on changed.
SemiAutomated fired by inner form ‘fSemiAutoItems’ in ‘Semi automated method’ on after record action.
DoRestart fired by ‘Delete all records…’ button, deletes all records in table “sold” and refreshes all forms and list boxes (saves repeated closure/opening of outer form and deletion of records when using the demo).
.
all sql statements are you own.
AddRecord_Demo.odb (15.4 KB)

1 Like

Set the save button’s properties “Default button” to Yes and “Visible” to No. The button won’t be visible but respond to the enter key.
A cancel button is very important, indeed.

1 Like

This is great, thank you so much to both of you gentlemen!!

I completely agree with you @cpb that the semi automatic method is the way to go. And The idea of setting the default button and hiding it, suggested by @Villeroy absolutely puts a cherry on top. Nonetheless, I appreciate the explanation of how the completely automatic method works. This was a truly great lesson for me.