How to put the URL path to each individual PDF file

I have a whole bunch of PDF files that I have in a database now.
I found the following code to run as a macro.

Sub InsertLocation
    Dim oForm as Object
    Dim oButton as Object
    oform = thiscomponent.FormDocuments.getByName("Get Document")
    oButton = oform.pbLocation
    oButton.TargetUrl = oform.Columns.getbyname("Location").getstring
End Sub

On each line of the form I put the path to the PDF.
The problem is that it works on the first one but I cannot find where to put the path for the other ones.
When I go into edit my form go blank so I cannot go to the the record and click on my “Get Document” button to the property page will come up so I can attach the correct PDF extension to the path.
So right n ow all 47 records open the same PDF. How can I fix this?

Thank you.

Hello,

Please refer to the answer in this post → How can a value be passed to URL in LO Base Form