I have a situation where we have a ton of pdf files residing on our IIS website. I cannot move these files. I am creating a catalog of these pdfs. All pdf filenames match their item numbers. For example, item ABCDE has a pdf whose filename is ABCDE.pdf For each item in the catalog, if the pdf exists, I need to show the link. If no pdf exists, it should be blank. I know how to formulate the link, but how can I test if the link produces an error 404 message?
Any help would be appreciated.
Subject: Formula to test link to external document?
You could put a script in an agent that runs either periodically (checking all the docs, all the links), or in postopen on the doc.
Note that the server would have to have access to the documents to give an accurate response. (So, if these are on the internet, it needs to be able to go out there and find them.)
Here’s a sample script that looks to the local hdd for a file, and if the fiel exists, it gives a messagebox telling if the length is more or less than 1, if it errors, it goes to an error script. I think you could modify this to ge tthe filename off your current doc, check for it, and on error go to error script - your error script could be to set a value, which, when hidden, would hide the link. (Sorry about the run-on sentence.)
Sub Click(Source As Button)
On Error Goto Errhandle
Dim verLen As Long
verLen& = Filelen("c:\silly.sys")
If (verLen < 1) Then Messagebox "less than one", 0, "ERROR" Else Messagebox "greater than 1", 0, "ERROR"
Errhandle:
’ Use the Err function to return the error number and
’ the Error$ function to return the error message.
Messagebox "there is no such file"
Exit Sub
End Sub
Subject: RE: Formula to test link to external document?
Thanks for your prompt response, Maria!
I’ll try that and let you know.
Cheers!