I use the following code snippet to open a form from a Base document.
oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oDataBase = oBaseContext.getByName(sDBURL)
oDBDoc = oDataBase.DatabaseDocument
oFormDef = oDBDoc.getFormDocuments().getByName(sFormName)
oDummyFormDef = oFormDef
oFormDocs = oDBDoc.getFormDocuments()
oCon = oDataBase.getConnection("", "")
AppendProperty(oParms(), "OpenMode", "open")
AppendProperty(oParms(), "ActiveConnection", oCon)
oFormDoc = oFormDocs.loadComponentFromURL(sFormName, "", 0, oParms())
If the Base document is loaded in the GUI, then this works with no
problem. If it is not, then it crashes OOo.
Typically, I do not use
oDBDoc = oDataBase.DatabaseDocument
but rather, I load the Base document from disk so that it is visible.
Any comments.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]