Form update question

I have a table control on a form in Base, which has a textbox column. My idea was to use “after updating” textbox event, as soon as I leave the row with a new record, to reload all the entries (including the new one) in an alphabetical order. However, I cannot commit that new entry to the form. Is my only solution to simply send an sql query to the database, and subsequently reload the form?

image

To getting the right sorting you could set the sorting for the form when defining the form.
After “Record Action” of the form a reload of the form will do what you want.
So you don’t need the textbox event.

SUB oFormReload(oEvent AS OBJECT)
   oForm = oEvent.Source
   oForm.reload
END SUB

To prevent the reload will happen two times (different implementations after record action) you could use something like IF hasUnoInterfaces(oForm, "com.sun.star.form.XForm" ) THEN

You don’t want to react on a control event. Actually, you want the data to be sorted whenever the record set has been modified, either by insertion, update or deletion.
Apache OpenOffice Community Forum - [Base, Python] Tiny Macro Refreshing Forms, List/Combo Boxes - (View topic) introduces a macro that can be set up to update anything anywhere within the same hierarchy of forms.
Download, open AutoRefresh.odt and click the install button.

  1. Assign the form’s “record action” event to the macro “My Macros”>pyDBA>AutoRefresh>Form_Action
  2. Use the form navigator to add a hidden control to the form. Hidden controls are useful to configure macro actions.
  3. Enter “AutoRefresh” as name of the hidden control and enter . (a point) as hidden value. The point refers to this form having the event and hidden control.
    Two points refer to this form’s parent. A hidden value ../Form1/TableControl1/Listbox1 would go one level up, then to “Form1”, “TableControl1” and refresh “Listbox1” within that table control. Multiple forms, listboxes or comboboxes can be specified this way, separated by semicolons.

Thank you both for your help. Greatly appreciated.