Ask Your Question

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

asked 2019-12-02 12:17:56 +0100

Coder99 gravatar image

updated 2020-08-05 00:12:15 +0100

Alex Kemp gravatar image

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


edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Coder99
close date 2019-12-04 07:12:16.382683

1 Answer

Sort by » oldest newest most voted

answered 2019-12-02 19:23:49 +0100

Ratslinger gravatar image



  • 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:

edit flag offensive delete link more


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

Coder99 gravatar imageCoder99 ( 2019-12-03 02:32:22 +0100 )edit


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.

Ratslinger gravatar imageRatslinger ( 2019-12-03 05:35:57 +0100 )edit

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.

Coder99 gravatar imageCoder99 ( 2019-12-03 05:44:13 +0100 )edit

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

Coder99 gravatar imageCoder99 ( 2019-12-03 05:49:24 +0100 )edit

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

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

Ratslinger gravatar imageRatslinger ( 2019-12-03 06:20:18 +0100 )edit

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

Coder99 gravatar imageCoder99 ( 2019-12-04 07:05:35 +0100 )edit

Question Tools

1 follower


Asked: 2019-12-02 12:17:56 +0100

Seen: 292 times

Last updated: Dec 04 '19