I have made a database to manage a collection of PDF documents where they can be selected by date, subject and persons envolved. It works perfectly but now I decided to add an action button to the form to open the document and I’m having difficulties creating a macro to open them.
In the form I have a text box named (txtPDF) connected to the table field (pdfName) where the pdf file folder and names are inserted (archive/001.pdf …) and the action button in the form named (openPDF) is set to “Opendocument/webpage”.
My macro is:
Sub GetPDF
oForm = ThisComponent.Drawpage.Forms.getByName(“MainForm”)
DocCtl = ThisComponent.getCurrentController()
oField = oForm.getByName(“txtPDF”)
oButton = oForm.getByName(“openPDF”)
CtlView = DocCtl.GetControl(oField)
oButton.TargetUrl = CtlView.Text
end sub
Can I have a little help? I don’t want you to make me a database, just tell me where I went wrong and if possible a little example. Thank You.