help with converting reports to PDF

associates

Registered User.
Local time
Today, 07:36
Joined
Jan 5, 2006
Messages
94
Hi,

I was wondering if anyone might be able to help me here. Today, i was trying to implement some codes i found on the internet that allows me to turn the Access report to PDF. Here is the site: http://www.mvps.org/access/reports/rpt0011.htm

However, it didn't work for me. I don't know if the codes's not for windows XP Pro or it's because of the fact i don't understand it properly.

Not sure if anyone has attempted to convert Report to PDF.

I have a form that has a few buttons on it. One of them is called view report. This is like a normal report from Access (nothing fancy about it). Another one is called "Convert to PDF". It will create a PDF file out of the report if user choose to click the button. The user doesn't get to see the access report. But if they go to a certain folder, they'd find it in PDF format. That's what i wanted to do.

So going back to the codes. I have copied those five modules from defaultprt.zip to my database: basDefaultPrinter, basGetPrinters, basIniFile, basPrintTypes, and basToken.

Then, i copied the following codes and paste it to basDefaultPrinter.

Code:
Private drexisting As aht_tagDeviceRec
Const AcrobatName = "Acrobat PDFWriter"
Const AcrobatDriver = "PDFWRITR"
Const AcrobatPort = "LPT1:"
Sub ResetDefaultPrinter() 
	Call ahtSetDefaultPrinter(drexisting)
End Function
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("Acrobat PDFWriter", _
            "PDFFileName", NewFileName)
End Sub

Next, i placed the next code to the button as follows
Code:
Private Sub CM_Convert2PDF_Click()
    DoCmd.OpenForm "frmDefaultPrinterList"
    ChangeToAcrobat
    ChangePdfFileName "C:\my1.pdf"
    DoCmd.OpenReport "Test_Report", acViewPreview
    ResetDefaultPrinter
End Sub

I didn't get any PDF report produced but instead the Access report that i got. I'm really keen to get this to work. I don't mind if anyone would like to share their ideas.

Thank you in advance
 
You will find lots of posts on this,and I don't think anyone has come up with this (auto) solution
most say instal pdf printer and manual store

I would live tihs function if it was automated
cause you could then stick it on the end of mkdir and the report would save after its done a make directory

so if you could up with a solution - please let me know
g
 

Users who are viewing this thread

Back
Top Bottom