Printing reports from an external form

I follow the tutorial from Chapter 9 Macros. What im trying to do is to make button function to execute the printing reports.

oDocument = StarDesktop.loadComponentFromURL(sURL, "_blank", 0, Arg() )

And I got this error

Type: com.sun.star.lang.IllegalArgumentException
Message: Unsupported URL <>: “from LoadEnv::startLoading”

Hello,

The error is because you are using a registered DB name in the standalone form Data Source (Data tab of Form Properties). If you use a URL instead (locate via ellipsis ...) then it will work - just retested without an error.

There are other macros which do work when using a registered DB name. See:

or

YOU ARE RIGHT!!! why i never think about that. THANKS ALOT