Open a form when running libreoffice base

I’ve worked on a project with a lot of forms. As this project is not intended for me but for people who are not at ease with this software, I was wondering if it was possible to open the main form directly when running libreoffice base ?
I tried to execute the classic open forms macro by assigning it to a bunch of actions in tools -> customize section, but at the execution, it returns an error saying that there isn’t a connexion to the DB, which I understand knowing that the macro is based of the current opened DB. But I don’t know other way to open a form. I’m totally new to base.

This is the macro I used.

Sub openMenu
const forms = "F_MENU"
link = ThisDatabaseDocument.FormDocuments.getbyname(forms).open
End Sub

Hi,

Try this macro

Sub openMenu
Dim ObjTypeWhat
Dim ObjName As String
ObjTypeWhat = com.sun.star.sdb.application.DatabaseObject.FORM
ObjName = "frmMenu" 'The name of the form you want to open at Base start-up, this needs to exist.
If ThisDatabaseDocument.FormDocuments.hasbyname(ObjName) Then 'Check the form exists
ThisDataBaseDocument.CurrentController.Connect() 'If the form exists connect to the database
ThisDatabaseDocument.CurrentController.loadComponent(ObjTypeWhat, ObjName, FALSE) 'Open the form
Else
MsgBox "Esto es vergonzoso, lo siento, ¡no puedo encontrar el formulario solicitado para abrir!"+chr(10)+"Form Name = " & ObjName + chr(10)+"Check the details." , 48, "DS4A SBM encountered a problem!"
End if
End Sub

In the database window go to tools customise, events, and assign the macro to the open document event