[Solved] Form contents after running query macro from a button

Hi there,
I have a Form displaying a single table (Table1), a record at a time (data-entry type form).
The standard record navigation buttons at the foot of the Form are active/working.
On the form I also have a button that runs a macro query against Table1

When the button is pressed, the macro query runs fine.

However, after the query is run, the linkage from the Form to Table1 seems to be broken and I’m no longer able to navigate through the table using the record navigation buttons. What happens is the record counter in the navigation bar changes to reflect the movement/navigation button pressed, BUT the form contents do not refresh/update.

What code do I need in the macro, after the Table1 query code, in order refresh the Form contents in accordance with the record navigation buttons, ie next record/prev record etc… ?




  • not stated how data is attached to form originally

  • what the query is

  • what macro code you are using

you typically would need to initialize the form with the new data:


Hi there,
Thanks for the reply, it works. The Form content is refreshed after running the query.

However, whilst the record navigation buttons at the foot of the form/screen ie next record/prev record etc do move the record counter as shown at the foot of the Form, the Form content is not updated/refreshed in sync with the navigation buttons.

To follow up on your points above;

The Form is a Table Form, displaying various fields from the Table.

The query is an update query run inside a macro, below. The macro is initiated from a push-button on the Table Form above.

Sub Reset_All_PrintSel (oEvent as object)
   Dim oForm, oCon, oSql as object
   oForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
   oCon = oForm.ActiveConnection
   oSql = oCon.CreateStatement()
   oSql.executeupdate("UPDATE `Members` SET `PrintSel` = False")
End Sub

The environment is

  • Windows 8.1

  • Libre Office (x64)

  • Database is MariaDB 10.3.11


Not the same set up - LO on Ubuntu 18.04 Mate with MySQL using JDBC connector but don’t see this as a conflict (except maybe the connector).

Set up a basic table and form based on what is in the comment and see no problem.

Form content is not updated/refreshed in sync with the navigation buttons.

is not clear. What is not in sync? Records show up fine in my test. BTW ran the macro at various times from a button on the form. Used both text and Yes/No (bool) fields in the test. No problems seen.

Hi there,
… by “not in sync” I mean that the contents of the Form do not change when a record navigation button is pressed; such as “next record” for example. The record number does change when the navigation button is pressed.

I’ll check availability of latest updates for LO and the JDBC connector on Windows…and re-test.

BTW I am using mysql-connector-java-5.1.45.jar

Also just retested with Navigation toolbar and navigation control. No problem with either.

Hi there,
Upgraded to LO and JDBC Connector 5-1.45 - problem still occurred with existing buttons.
Creating new buttons on existing forms did not resolve the problem either.
Problem resolved by creating new forms and new buttons to run the various macros. With the new buttons on new forms the record navigation was preserved after running the macro. .
Also no need to Reload the form at macro end, except where macros changed underlying table data.
Seems there is an issue with the earlier version of LO and/or JDBC NOT retaining synchronisation between record navigation buttons and record data displayed in the Form; after macro call/SQL execution/report printing.