How to run sql command in basic within detached writer form

OS Ubuntu 21.04 and Windows 10
Libreoffice 7.1.4.2 and 7.1.5.2 respectively

base document linked to MYSQL 5.7.037 server

Form within this document runs SQL command using:

    Dim oStatement As Object
DIM sSQL as string
sSQL = "SQL statement here"
oStatement = Thisdatabsedocument.CurrentController.ActiveConnection.createStatement()
oStatement.execute(sSQL)

After detaching the form and running it as standalone .odt document, above macro doesn’t work.
I have base database registered as data source, and everything but the sql macro above works as intended.

Thisdatabasedocument is only valid for base documents.
ThisComponnent of my form does not have CurrentController property.
StarDesktop.getController() returns void
I am lost here.

It works using :
oStatement = ThisComponent.Drawpage.Forms.EditForm.ActiveConnection.createStatement()