Output report to PDF with a default pdf file name

F

FA

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
//*********
 
S

SteveS

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top