So, I realized today that it was probably possible to set up something so that I could click a button in the form and open the file (each record refers to a specific file on my hard drive) in whatever program my computer could do it in. Sure enough, when I did a search, I found this thread detailing how to do that.
However, I must have made an error of some kind when following the directions, because when I put in the full file path (filename, extension, and all) and went forward and backward records to make sure it's been stored in the database, clicking on the button I assigned to open it only results in the following error:
Code: Select all
BASIC runtime error.
An exception occurred
Type: com.sun.star.container.NoSuchElementException
Message: .
What I put is (copied from the other thread, with only substituting the names):
Code: Select all
REM ***** BASIC *****
' You need two controls in your form(document). They must be in the same form(as in navigator).
' One control is a text control and contains the pathname or url to the file.
' The second control is a button.
' The action is bound to the first event of the button control: Before commenting
' The name is new in OOo3.2 and later : Approve action
' The function can be aborted when the files does not exist.
' You also have change the properties of the button control.
' The action is :Open document/webpage.
' The small macro moves the field value from the textbox to the button control url
function openurl(oEv as object)
dim oForm as object
dim oTextBox as object
dim oTextBoxtest as object
dim oMRI as Object
oDoc = ThisComponent
oForm=oEv.source.model.parent
oTextBox=oForm.getbyname("MainForm").getbyname("txtOfflineLink")
if FileExists ( oTextBox.text) then
oEv.source.model.targeturl=oTextBox.text
openurl=true ' Do the program when the file exists
else
openurl=false ' The file does not exist and do nothing
end if
End function