 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
hisaw
Joined: 01 Apr 2008 Posts: 2
|
Posted: Tue Apr 01, 2008 11:24 am Link to pdf file on server |
|
|
|
Hi,
I'm new to html and am not sure if this will work, but here's what I am trying to do. In my Access database, I have a form that lists all our literature. There is a button next to each entry labeled "pdf" so that when user clicks it, it will open a pdf file to view that specific piece of literature.
Because all users don't have a copy of Access (that's another story), as a quick fix (until I can get a company web page set up) I have copied this form as an Access Data Page for intranet use. The problem I have run into is that it uses html code and I'm more familiar with VB.
What I want to happen on this form is the literature name that is listed in field "Item Name" for particular record to open that related pdf. I can target the link to open folder that contains all pdf's, but not open the specific file listed in "item name". I need a "where" clause. Is this possible?
I've listed the code I use in VB on the regular database form in case this is not clear.
Private Sub Command21_Click()
Dim strPath As String
strPath = "\\dell4\databases\PDF\" & Me.[ITEM NUMBER] & ".pdf"
If Dir(strPath) = "" Then
MsgBox "There is no pdf for this brochure."
Else
Application.FollowHyperlink strPath
End If
End Sub
Thanks in advance for any help. I've been searching for days trying to find a solution and am not sure it's even possible.
Hisaw |
|
quartzy
Joined: 26 Dec 2007 Posts: 400
|
Posted: Fri Apr 04, 2008 12:48 pm re |
|
|
|
| I think what you need is for the html to reference the file name. With a path name. As far as I know this works online but I am not sure what you need to do. |
|
kanenas

Joined: 14 Dec 2004 Posts: 191
|
Posted: Tue Apr 29, 2008 1:17 pm Use 'href' attribute. |
|
|
|
I'm no Access guru, and you probably already resolved this one, but...
Short description: If the page is statically generated, edit the HTML file and set the href attribute of each A element to the URL of the relevant PDF.
For example:
| Code: |
| <a href="file:///dell4/databases/PDF/5.pdf">Visit Finland</a> |
Note the use of backslashes rather than forward slashes. If the page is dynamically generated (using e.g. ASP), you'll need to alter the server-side script in order to set the href attribute; the exact way of doing this depends on the script, but you should be able to use your knowledge of VB to figure out where the link is being generated, then set the href property to the URL. It'd probably look something like:
| Code: |
| link.href= "file:///dell4/databases/PDF/" & Me.[ITEM NUMBER] & ".pdf" |
I'm just guessing that the record is stored in 'Me'. |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|