A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

link to a pdf



 
 
Thread Tools Display Modes
  #1  
Old March 25th, 2008, 06:40 PM posted to microsoft.public.access.forms
rml
external usenet poster
 
Posts: 172
Default link to a pdf

How can I create a command button that would open or link to a pdf depending
on the Part Number field value?

If Part Number equals abc123 then open abc123.pdf, if no corresponding pdf
exists, then display some text , "not available". The pdf would be located
in the c:\drawings folder.

Thanks.
  #2  
Old March 25th, 2008, 08:08 PM posted to microsoft.public.access.forms
Stockwell43
external usenet poster
 
Posts: 579
Default link to a pdf

You could make a table with all your Pdfs hyperlinked and then create a cbo
with the table as it's row source? This way they can select the PDF from the
cbo. It just a thought. Plus, you can easily update it as well.

"rml" wrote:

How can I create a command button that would open or link to a pdf depending
on the Part Number field value?

If Part Number equals abc123 then open abc123.pdf, if no corresponding pdf
exists, then display some text , "not available". The pdf would be located
in the c:\drawings folder.

Thanks.

  #3  
Old March 25th, 2008, 08:08 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default link to a pdf

"rml" wrote in message
...
How can I create a command button that would open or link to a pdf
depending
on the Part Number field value?

If Part Number equals abc123 then open abc123.pdf, if no corresponding pdf
exists, then display some text , "not available". The pdf would be
located
in the c:\drawings folder.



For example:

'----- start of (untested) example code -----
Private Sub cmdViewPDF_Click()

Dim sPartNo As String
Dim sPDFName As String
Const conDrawingFolder As String = "C:\Drawings\"

sPartNo = Me![Part Number] & vbNullString

If Len(sPartNo) = 0 Then
MsgBox "There's no current part number!"
Else
sPDFName = conDrawingFolder & sPartNo & ".pdf"
If Len(Dir(sPDFName)) = 0 Then
MsgBox "No drawing is available for this part."
Else
Application.FollowHyperlink sPDFName
End If
End If

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

  #4  
Old April 8th, 2008, 02:59 PM posted to microsoft.public.access.forms
rml
external usenet poster
 
Posts: 172
Default link to a pdf

That worked! Thanks.

"Dirk Goldgar" wrote:

"rml" wrote in message
...
How can I create a command button that would open or link to a pdf
depending
on the Part Number field value?

If Part Number equals abc123 then open abc123.pdf, if no corresponding pdf
exists, then display some text , "not available". The pdf would be
located
in the c:\drawings folder.



For example:

'----- start of (untested) example code -----
Private Sub cmdViewPDF_Click()

Dim sPartNo As String
Dim sPDFName As String
Const conDrawingFolder As String = "C:\Drawings\"

sPartNo = Me![Part Number] & vbNullString

If Len(sPartNo) = 0 Then
MsgBox "There's no current part number!"
Else
sPDFName = conDrawingFolder & sPartNo & ".pdf"
If Len(Dir(sPDFName)) = 0 Then
MsgBox "No drawing is available for this part."
Else
Application.FollowHyperlink sPDFName
End If
End If

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.