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