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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|