An alternate way to make the main database window go away on startup is to create a macro that activates on the
Open Document event. The result will that the database window is open for less than a second at startup and then disappears in favor of your switchboard. The principle behind this is easy to implement, but there is bulk added to the solution to avoid some common problems and make it work automatically at startup.
First, you will need to create a new
My Macros. Go to
Organize Macros →
My Macros and click the button
Organizer and then in the new dialog, click the tab
New and choose a name. Then in the
Macro window click
New to add a
Module to the library. This must be the module you use. This is necessary to allow the macro to be invoked from a document-level macro.
Second, create a subroutine in the module. Here is the annotated subroutine. The key part is the
REM '***** BASIC *****'
REM 'catch any error to give alternate instructions to user'
On Local Error Goto ErrHandOpenDB
REM 'if applied to the `Open Document` event `ThisComponent` is equivalent to `ThisDatabaseDocument`'
REM 'the difference being `ThisComponent` works'
tc = ThisComponent
REM 'this loop is to work around a delay in defining `ThisComponent` by LO'
i = 1
Do Until InStr(tc.dbg_properties, "CurrentController" ) > 0 Or i >= 70
tc = ThisComponent
i = i + 1
REM 'work around more LO limitations when atteming to run on `Open Document` event'
tc.Title = "Title that is displayed at the top of the window and can be used in form titles"
REM 'here is the object hierarchy to get to the database window'
cntrllr = tc.CurrentController
REM 'belt and suspenders, this might not be necessary'
If cntrllr.isConnected = False Then
REM 'more of the object hierarchy'
frm = cntrllr.Frame
appWindow = frm.ContainerWindow
REM 'make main application window disappear'
appWindow.IsMaximized = False
REM 'FYI this is the window inside the application window, if can be resized independently'
REM 'but have not seen any use for this yet'
REM comWin = frm.ComponentWindow
REM 'open switchboard form'
FrmContainer = tc.FormDocuments.getByName("switchboard")
rootFrm = FrmContainer.Component.getDrawPage.getForms
rootDoc = rootFrm.parent
ctrllr = rootDoc.CurrentController
frm = ctrllr.Frame
REM 'apply title of database set forth above plus title of form'
frm.Title = tc.Title & ": switchboard"
REM 'maximize the switchboard window'
frmWindow = frm.ContainerWindow
frmWindow.IsMaximized = True
REM 'FYI again here is the window inside the form window'
REM frmComp = frm.ComponentWindow
REM 'adjust zoom of switchboard'
ctrllr.ViewSettings.ZoomValue = 90
MsgBox "The intro did not go as planned. Browse to `Forms` and open the `Switchboard`."
Assign the macro to the
Open Document event in your document.
My Macros. Go to
Organize Macros: navigate to your macro and then
Assign button. Assign the
Macro to the
Open Document event in your
odb document (be aware of the list option at the bottom).
Fourth, if you have other users, you will need to distribute this
Macro library to them. It is easy to do this by going to the
My Macros view in the
Macros window and then clicking the button
Organizer..., go to the
Libraries tab and click
Export preferentially as a
Fifth, for any other computer using this document, install the
As you can see, this is a little more involved than many other macro operations. Also note a significant bug when working with
(if this answers your question, please accept the answer by clicking the check () to the left)