Here's what I want to do:
There's a MySQL-database that is accessed via JDBC-Connector. The Frontent is done in OpenOffice 3.2.1 (WinXP) with several Forms that are stored as single Writer-Documents. To swith between forms, I use oDocFrame.loadComponentFromURL( cUrl, "_self", 0, args() ) and it works without problems.
Now I want to change a form and open a specific record in the other form.
I do it with the following makros:
Form1
Code: Select all
oform=ThisComponent.drawpage.forms.getbyname("MainForm")
if( oform.filter <> "" OR oform.ApplyFilter=TRUE ) then
oform.filter= ""
oform.ApplyFilter=FALSE
end if
Dim args(2) As New com.sun.star.beans.PropertyValue
args(0).Name = "ActiveConnection"
args(0).Value = getConnectionTC
args(1).Name = "OpenMode"
args(1).Value = "open"
args(2).Name = "MacroExecutionMode"
args(2).Value = com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE
oDoc = ThisComponent
oDocCtrl = oDoc.getCurrentController()
oDocFrame = oDocCtrl.getFrame()
cUrl = ConvertToURL( "FORM2" )
oDocument=oDocFrame.loadComponentFromURL( cUrl, "_self", 0, args() )
sScriptURI = "vnd.sun.star.script:FORM2.btnsJur.JurPkFilt.InsertValues?language=Basic&location=document" ' My Filter-Makro in Form 2
oScriptProvider = oDocument.getScriptProvider()
oScript = oScriptProvider.getScript(sScriptURI)
oScript.invoke(Array(Key_To_Filter_For), Array(), Array() )
Form2
Code: Select all
Sub JurPkFilt( idx AS INTEGER )
oform=ThisComponent.drawpage.forms.getbyname("MainForm")
oform.filter= "( `buz`.`FORM2`.`pkJurPersonNr` = " & idx & ")"
oform.ApplyFilter=TRUE
oform.reload
END SUB
Any Ideas what goes wrong here?
If not: Any ideas how I can archieve my goal -- open FORM2 with a macro in FORM1 and tell FORM2 to select a specific record -- in another way?