D
Deema via AccessMonster.com
Hi,
I need to print and save a report in access97 automatically as
pdf... I saw this code that is done by Ken Getz and Paul Litwin,
when i add the last part that calls the module in "ON Click" i get
an error message " Ambiguous name detected: ChangeToAcrobat"..
PS: I imported the modules from defaultprt.zip....
Could anyone tell me how to fix this problem.
thanks for any help you can give.
=====================================================
Option Compare Database
Option Explicit
' These functions used with procedures from
' Microsoft Access 95 How-To
'(c) 1998 Ken Getz and Paul Litwin
' All rights reserved.
' Other modules from this source are:
' basDefaultPrinter
' basGetPrinters
' basIniFile
' basPrintTypes
' basToken
' You'll also need defaultprt.zip
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
Create the print file. To do this, add the following lines to the
appropriate place in your code (perhaps in reaction to a button
click):
ChangeToAcrobat
ChangePdfFileName "Name of pdf file including .pdf"
DoCmd.OpenReport "YourReportName", acViewNormal
ResetDefaultPrinter
I need to print and save a report in access97 automatically as
pdf... I saw this code that is done by Ken Getz and Paul Litwin,
when i add the last part that calls the module in "ON Click" i get
an error message " Ambiguous name detected: ChangeToAcrobat"..
PS: I imported the modules from defaultprt.zip....
Could anyone tell me how to fix this problem.
thanks for any help you can give.
=====================================================
Option Compare Database
Option Explicit
' These functions used with procedures from
' Microsoft Access 95 How-To
'(c) 1998 Ken Getz and Paul Litwin
' All rights reserved.
' Other modules from this source are:
' basDefaultPrinter
' basGetPrinters
' basIniFile
' basPrintTypes
' basToken
' You'll also need defaultprt.zip
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
Create the print file. To do this, add the following lines to the
appropriate place in your code (perhaps in reaction to a button
click):
ChangeToAcrobat
ChangePdfFileName "Name of pdf file including .pdf"
DoCmd.OpenReport "YourReportName", acViewNormal
ResetDefaultPrinter