Base - Load default form when opening database

Hi! How can I make Base open a specific form automatically every time I open an .odb file?

Thanks!

here are a two macro’s, the first covers your question, the other is optional

'===== attach to event "open document" that is: with opened document : tools > customise > events > open document

sub autoexec()
dim oController as object
oController = ThisDatabaseDocument.CurrentController
if Not oController.isConnected() Then oController.connect()
oController.loadComponent(com.sun.star.sdb.application.DatabaseObject.FORM,"frmMENU",FALSE)
end sub

'========= macro attached to a knob event 'mouse up' to open a form 
sub OpenForm(oEvent as object)
   dim oDoc as object
dim sTemp as string
oDoc = oEvent.source.model
sTemp = oDoc.getName()  ' name of the knob is name of the form to open
 
ThisDatabaseDocument.FormDocuments.getByName(sTemp).open
exit sub

Thank you very much, I have it working!

Tiny typo: ThisDatabaseDocumentCurrentController should be ThisDatabaseDocument.CurrentController