I found this macro below online, its function is to open an OpenOffice Base form from another one which contains a table/grid with all records
To be clear: imagine you have a table/grid form with you records and you want to open one particular record from this table. You just want to click on its row to select it and then this macro will open it in a different form with all its details. See picture, please.
But two messages show:
1) "Runtime Error BASIC Variable not defined." and stops on line "forms ThisComponent.Parent.getFormDocuments = ()" in my main project
2) or "runtime error BASIC Property or method not found :. ID." and stops on line "i = oStartForm.columns.ID.getInt" in my attached sample.
I attach also a db sample to understand macro mechanics; my true project is already filled with many personal data and it is more complex.
So I prefer the K.I.S.S. rule...
Code: Select all
Sub ApriFormCompilazioneDaTabella ()
Dim prop(1) as New com.sun.star.beans.PropertyValue
forms=ThisComponent.Parent.getFormDocuments()
conn=ThisComponent.Parent.DataSource.getConnection("","")
prop(0).Name="ActiveConnection"
prop(0).Value=conn
prop(1).Name="OpenMode"
prop(1).Value="open"
oStartDoc = ThisComponent
oStartForm = oStartDoc.drawpage.forms.MainForm
i = oStartForm.columns.ID.getInt
oNewDoc = forms.loadComponentFromURL("Compilazione_by_strike_lf","_blank",0,prop())
oNewDocForm = oNewDoc.drawpage.forms.MainForm
wait 100
oNewDocForm.Filter = "ID ='" & i & "'"
oNewDocForm.ApplyFilter = True
oNewDocForm.Reload
End Sub