Hi all, newbie here. I have been through I think the majority of the solutions offered for this. I did have a solution but now it is not working and throwing up the following error.
Error #1501 (No active connection to a database found) occurred in a call to function ‘Forms’
I have probably made some silly mistake. The basis of the macro is from another question.
Sub OpenForm ()
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.ProtectionID.getInt
oNewDoc = forms.loadComponentFromURL("Protection","_blank",0,prop())
oNewDocForm = oNewDoc.drawpage.forms.MainForm
wait 100
oNewDocForm.Filter = "ProtectionID ='" & i & "'"
oNewDocForm.ApplyFilter = True
oNewDocForm.Reload
End Sub
I would be very grateful for any help. Thank you.
Edited by @Ratslinger for readability (use preformatted text icon on toolbar)