von Toxitom » So, 29.07.2007 18:02
Hallo Tarno,
Lösung steht auch irgendwo im Buch, vielleicht nicht bei den Berichten.... bzw. kommt in der nächsten Auflage
Hier mal ein Codebeispiel, wie du ein weiteres Formular per "Knopfdruck" öffnen kannst. Berichte gehen analog, musst du halt entsprechend anpassen.
Code: Alles auswählen
Sub Formular_Oeffnen
dim sFormularName as string, i as integer
dim oContext as object, oDB as Object, oVerb as object
dim arg(1) as new com.sun.star.beans.PropertyValue
dim aListe()
sFormularName = "Artikel"
REM alleFormulare und Bericht
aListe = StarDesktop.CurrentComponent.getFormDocuments().getElementNames()
REM das richtige suchen
for i = lBound(aListe) to uBound(aListe)
if aListe(i) = sFormularName then
oContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oDB = oContext.getByName(StarDesktop.CurrentComponent.GetLocation)
oVerb = oDB.getConnection("", "")
arg(0).Name = "OpenMode"
arg(0).Value = "open"
arg(1).Name = "ActiveConnection"
arg(1).Value = oVerb
StarDesktop.CurrentComponent.getFormDocuments(). loadComponentFromURL(aListe(i), "", 0, arg())
Exit sub
end if
next
End Sub
Viele Grüße
Thomas
Hallo Tarno,
Lösung steht auch irgendwo im Buch, vielleicht nicht bei den Berichten.... bzw. kommt in der nächsten Auflage ;-)
Hier mal ein Codebeispiel, wie du ein weiteres Formular per "Knopfdruck" öffnen kannst. Berichte gehen analog, musst du halt entsprechend anpassen.
[code]Sub Formular_Oeffnen
dim sFormularName as string, i as integer
dim oContext as object, oDB as Object, oVerb as object
dim arg(1) as new com.sun.star.beans.PropertyValue
dim aListe()
sFormularName = "Artikel"
REM alleFormulare und Bericht
aListe = StarDesktop.CurrentComponent.getFormDocuments().getElementNames()
REM das richtige suchen
for i = lBound(aListe) to uBound(aListe)
if aListe(i) = sFormularName then
oContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
oDB = oContext.getByName(StarDesktop.CurrentComponent.GetLocation)
oVerb = oDB.getConnection("", "")
arg(0).Name = "OpenMode"
arg(0).Value = "open"
arg(1).Name = "ActiveConnection"
arg(1).Value = oVerb
StarDesktop.CurrentComponent.getFormDocuments(). loadComponentFromURL(aListe(i), "", 0, arg())
Exit sub
end if
next
End Sub
[/code]
Viele Grüße
Thomas