I'm having a problem with opening a form from a button for some reason... I've found multiple posts with macro code that's to be mapped to a button to open a form....
for some reason I get an error with each and every one of them.... here's the code I'm using:
Code: Select all
REM Generic macros needed to open any form
function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) as variant
Dim aProp(1) As New com.sun.star.beans.PropertyValue
aProp(0).Name = "ActiveConnection"
aProp(0).Value = oConnection
aProp(1).Name = "OpenMode"
aProp(1).Value = "open"
OpenForm = formContainer.loadComponentFromURL(sFormName,"_blank",0,aProp())
end function
function getFormsTC() as variant
getFormsTC = thisComponent.Parent.getFormDocuments
end function
function getConnectionTC() as variant
getConnectionTC = thisComponent.Drawpage.Forms(0).ActiveConnection
end function
REM Macro to open specific form called 'Locations Data Entry'. One is needed for each form you wish to open from another form.
sub OpenForm_unos( oev as variant )
sFormName = "Admin_Nalazi_unos"
OpenForm( getFormsTC, getConnectionTC, sFormName )
end sub
BASIC runtime error.
An exception occured
Type: com.sun.star.lang.IllegalArgumentException
Message: .
and it's pointing to:
OpenForm = formContainer.loadComponentFromURL(sFormName,"_blank",0,aProp())