Click to See Complete Forum and Search --> : VBScript <A href=file output error


dlsiegers
September 30th, 2002, 01:58 PM
Hi,

Here's what I'm trying to do.

wohno is a variable assigned for a work order number.

strSQL= strSQL & " '<A href=file:' + 'P:\' + wohno + '.pdf' + '>' + wohno + '</A>' "

When i go to click on this it doesn't take the whole file path and I'm pretty sure it's because the file and path aren't in double quotes. I just can't figure out how to put them in so that it works.

any help would be much appreciated
Dione

Andyb
September 30th, 2002, 02:25 PM
strSQL ='<A href=file:' + 'P:/' + wohno + '.pdf' + '>' + wohno + '</A>'

try turning backslashes into forward slashes and see if that works.

dlsiegers
September 30th, 2002, 02:44 PM
So apparently I'm having a moment. It does display the workorder number, what it doesn't display is the .pdf at the end. Am I doing it correctly. I want this to create a pdf file that I can open later.

I'm not sure if it's the correct way to do it.

Dione

websmith99
September 30th, 2002, 02:59 PM
To play it safe you should change it to this:

strSQL = strSQL & " '<a href=\"file:///P:/' + wohno + '.pdf\">' + wohno + '</a>' "

Note that the href is surrounded in quotes to be XHTML compliant and to be safe in case a file name or directory contains spaces. Also the file protocol specifier should be followed by 3 forward slashes.