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.
Next, i placed the next code to the button as follows
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
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