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 Programming / April 2006

Tip: Looking for answers? Try searching our database.

Output report to PDF with a default pdf file name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
FA - 06 Apr 2006 22:41 GMT
Hi, I am trying to output a report from MS Access to PDF. Below are my
codes but i want the pdf file name to be strFileName but its not giving
me the file name that i want as a default.
Can someone tell me what i am doing wrong?

Thanks alot

//*****
Private Sub rptFindingReport_Click()
ChangeToAcrobat
Dim strFileName As String
strFileName = Me.SYS_CODE & "-" & Format(Me.TEST_BEGIN_DATE,
"yyyymmdd")
ChangePdfFileName "strFileName"
DoCmd.OpenReport "FindingReportForAccess", acViewNormal
ResetDefaultPrinter
End Sub
//******

//******
Private drexisting As aht_tagDeviceRec
Const AcrobatName = "Adobe PDF"
Const AcrobatDriver = "Adobe PDF Converter"
Const AcrobatPort = "Data\*.pdf"

Sub ResetDefaultPrinter()
   Call ahtSetDefaultPrinter(drexisting)
End Sub
Function ChangeToAcrobat()
   If ahtGetDefaultPrinter(drexisting) Then
       Dim dr As aht_tagDeviceRec
       With dr
           .drDeviceName = AcrobatName
           .drDriverName = AcrobatDriver
           .drPort = AcrobatPort
       End With
       Call ahtSetDefaultPrinter(dr)
  End If
End Function

Sub ChangePdfFileName(NewFileName As String)

  Call aht_apiWriteProfileString("Adobe PDF", _
           "PDFileName", NewFileName)
End Sub
//*********
SteveS - 09 Apr 2006 03:22 GMT
I would guess that the file is being named "strFileName.pdf".

In Sub rptFindingReport_Click(), you have a line:

ChangePdfFileName "strFileName"

You are passing the text string "strFileName" to the Sub "ChangePdfFileName()"

Change the line to (no quotes):

ChangePdfFileName strFileName

As I said, it is just a guess.

HTH
Signature

Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)

> Hi, I am trying to output a report from MS Access to PDF. Below are my
> codes but i want the pdf file name to be strFileName but its not giving
[quoted text clipped - 42 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.