Is it possible to perform a macro that inserts an SQL command into a Form table?

Hello everyone, I would like to know if it is possible to perform a macro that inserts an SQL command in a Libreoffice Base Form table, so that the table presents the result of the query?

I know you can do this action in the following way: Form Properties > Data > Content > "Here I can put the query"

But is it possible to do this with a Macro?

  • Operating system: Linux Mint 20.1
  • Ulyssa base: Ubuntu 20.04 focal
  • Database used: Built-in Firebird
  • Version LO: 7.1.4.2

Hello,

Just need to change command and type in the form accordingly.

Reference → constants group CommandType

Sample ---- SwitchToQuery.odb

Edit:

An SQL command is similar:

oForm.commandType = 2
oForm.command = "SELECT * FROM ""Etiologia"""

Edit 2:

Sample with SQL and where (although a filter could do this):

Sample 2 ------- SwitchToQuery2.odb

I tested it and it worked in my Database too. Thank you so much Ratslinger!