Ask Your Question
0

base - Load default form when opening database

asked 2020-12-14 07:04:24 +0100

stabiloboss gravatar image

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

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-12-14 09:52:26 +0100

parsely gravatar image

updated 2020-12-14 16:07:37 +0100

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
edit flag offensive delete link more

Comments

Thank you very much, I have it working!

Tiny typo: ThisDatabaseDocumentCurrentController should be ThisDatabaseDocument.CurrentController

stabiloboss gravatar imagestabiloboss ( 2020-12-14 11:23:11 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-12-14 07:04:24 +0100

Seen: 38 times

Last updated: Dec 14 '20