Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / April 2008

Tip: Looking for answers? Try searching our database.

pdf link

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rml - 01 Apr 2008 14:36 GMT
I'm using the following code to try and open a pdf file if the New2 is equal.
Example:  If in the new2 field the value was 12345 you would click the
command button and if 12345.pdf exists then open, if not then some message.

Is the code below correct?  When I click the button nothing happens?

Thanks.

Private Sub cmdViewPDF_Click()

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

   sPartNo = Me![New2] & 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
Douglas J. Steele - 01 Apr 2008 14:41 GMT
It looks okay. Are you sure it's actually running? Make sure that the On
Click property for the button is set to [Event Procedure]. If it is, click
on the ellipsis (...) to the right, and make sure you get taken into that
code in the VB Editor.

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> I'm using the following code to try and open a pdf file if the New2 is
> equal.
[quoted text clipped - 26 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.