would be even better added here : Macros for LibreOffice Base - The Document Foundation Wiki
since all these back and forth here makes the topic unreadable
Sky,
Further below is the latest version of the macro to run a report from a button.
It includes all your suggestions including the “debug” code you suggested.
I have also tripple-checked the report name.
When I run the macro, I get a “Basic runtime error. Variable not defined.” error with the code line “If thisDatabaseDocument.reportDocuments.hasByName(“Job Schedule Report”) then” highlighted.
Sub Run_Report()
Dim oForm as Object
oForm = thisComponent.drawPage.forms.getByIndex(0)
If oForm.isNew() then
oForm.insertRow()
Else
oForm.updateRow() 'If I get an error here its because the form is not displaying data
Endif
If thisDatabaseDocument.reportDocuments.hasByName("Job Schedule Report") then
thisDatabaseDocument.reportDocuments.getByName("Job Schedule Report").open()
Else
msgBox("A report with the name 'Job Schedule Report' does not exist")
Endif
End sub
Added backticks to correctly display code as @nebergall seems not to have noticed my advice above [robleyd]
Hmmm, the only thing else to do is upload a stripped down version of your odb so I can do a hands on debug. We probably should have started with this and saved a lot of fruitless back and forths.