By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,705 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,705 IT Pros & Developers. It's quick & easy.

Trouble shooting PDF output

P: n/a
Access XP
WinXP
Adobe Acrobat 5.0

I'm playing with Keri Hardwick's "Save a report's output as a PDF file" and
most of it still works. The problem is the ChangePdfFileName is not changing
the file name and it is storing the file in "My Documents" with the standard
report name. What appears to be going on is that the PDFWriter is not
reading the PDFFilename from the Win.ini. It's reading the PDFFilename value
from the registry if it exsists. If it doesn't exsist it just uses default
values which I don't want.
Here is the code so far:
Start Code
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.

Private drexisting As aht_tagDeviceRec
Const AcrobatName = "Acrobat PDFWriter"
Const AcrobatDriver = "PDFWRITR"
Const AcrobatPort = "LPT1:"
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("Acrobat PDFWriter", "PDFFileName",
NewFileName)
End Sub
And Here is the trigger for the whole thing:
Private Sub Command6_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RptDailyPDF"
DoCmd.Close acReport, "RptDailyPDF"
stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
"[WSDate1] = " & "'" & Me![WSDate1] & "'"

ChangeToAcrobat
ChangePdfFileName ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
DoCmd.OpenReport stDocName, acViewNormal, , stLinkCriteria
ResetDefaultPrinter

End Sub
End code


Everything works except the file rename like I described. Any help is
appriciated. Also, I haven't posted any questions in a very long time so if
I've stepped on toes or violated a FAQ rule somewhere, just let me know and
I'll reform my ways.

Thanks,

Michael Harris
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003
Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
For Win NT, 2K, XP PDFWriter stores the file name in the registry, not in
the ini file.
Check the Acrobat SDK for the key.

--

Alphonse Giambrone
Email: a-giam at customdatasolutions dot us
"Michael Harris" <mi************@comcast.net> wrote in message
news:vBznb.52067$HS4.235982@attbi_s01...
Access XP
WinXP
Adobe Acrobat 5.0

I'm playing with Keri Hardwick's "Save a report's output as a PDF file" and most of it still works. The problem is the ChangePdfFileName is not changing the file name and it is storing the file in "My Documents" with the standard report name. What appears to be going on is that the PDFWriter is not
reading the PDFFilename from the Win.ini. It's reading the PDFFilename value from the registry if it exsists. If it doesn't exsist it just uses default
values which I don't want.
Here is the code so far:
Start Code
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.

Private drexisting As aht_tagDeviceRec
Const AcrobatName = "Acrobat PDFWriter"
Const AcrobatDriver = "PDFWRITR"
Const AcrobatPort = "LPT1:"
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("Acrobat PDFWriter", "PDFFileName",
NewFileName)
End Sub
And Here is the trigger for the whole thing:
Private Sub Command6_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RptDailyPDF"
DoCmd.Close acReport, "RptDailyPDF"
stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
"[WSDate1] = " & "'" & Me![WSDate1] & "'"

ChangeToAcrobat
ChangePdfFileName ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
DoCmd.OpenReport stDocName, acViewNormal, , stLinkCriteria
ResetDefaultPrinter

End Sub
End code

Everything works except the file rename like I described. Any help is
appriciated. Also, I haven't posted any questions in a very long time so

if I've stepped on toes or violated a FAQ rule somewhere, just let me know and I'll reform my ways.

Thanks,

Michael Harris
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003

Nov 12 '05 #2

P: n/a
SA
Mike:

Keri's code will not work on any machine with Acrobat 4.0 and above if the
os is NT / 2K / Xp. That is because the PDFWriter specs are now stored in
the registry on those os under HKCU\Software\Adobe\Acrobat PDFWriter.

If you want to not flail around writing the code, check out our PDF and Mail
Library for Access which can make outputting PDF files with PDF Writer,
Distiller or any a number of other PDF drivers quite easy. You'll find it
on our web in the developer tools section.

HTH
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

"Michael Harris" <mi************@comcast.net> wrote in message
news:vBznb.52067$HS4.235982@attbi_s01...
Access XP
WinXP
Adobe Acrobat 5.0

I'm playing with Keri Hardwick's "Save a report's output as a PDF file" and most of it still works. The problem is the ChangePdfFileName is not changing the file name and it is storing the file in "My Documents" with the standard report name. What appears to be going on is that the PDFWriter is not
reading the PDFFilename from the Win.ini. It's reading the PDFFilename value from the registry if it exsists. If it doesn't exsist it just uses default
values which I don't want.
Here is the code so far:
Start Code
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.

Private drexisting As aht_tagDeviceRec
Const AcrobatName = "Acrobat PDFWriter"
Const AcrobatDriver = "PDFWRITR"
Const AcrobatPort = "LPT1:"
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("Acrobat PDFWriter", "PDFFileName",
NewFileName)
End Sub
And Here is the trigger for the whole thing:
Private Sub Command6_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RptDailyPDF"
DoCmd.Close acReport, "RptDailyPDF"
stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
"[WSDate1] = " & "'" & Me![WSDate1] & "'"

ChangeToAcrobat
ChangePdfFileName ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
DoCmd.OpenReport stDocName, acViewNormal, , stLinkCriteria
ResetDefaultPrinter

End Sub
End code

Everything works except the file rename like I described. Any help is
appriciated. Also, I haven't posted any questions in a very long time so

if I've stepped on toes or violated a FAQ rule somewhere, just let me know and I'll reform my ways.

Thanks,

Michael Harris
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003

Nov 12 '05 #3

P: n/a
Thanks to both of you for your responses.

Ok, yes I've figured that out. So I guess what I need to know now is how do
I add the registry key from Access? I already know SaveSetting won't work.
Any other ideas?
"SA" <~f***********@nspm.com> wrote in message
news:bn**********@ngspool-d02.news.aol.com...
Mike:

Keri's code will not work on any machine with Acrobat 4.0 and above if the
os is NT / 2K / Xp. That is because the PDFWriter specs are now stored in
the registry on those os under HKCU\Software\Adobe\Acrobat PDFWriter.

If you want to not flail around writing the code, check out our PDF and Mail Library for Access which can make outputting PDF files with PDF Writer,
Distiller or any a number of other PDF drivers quite easy. You'll find it
on our web in the developer tools section.

HTH
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

"Michael Harris" <mi************@comcast.net> wrote in message
news:vBznb.52067$HS4.235982@attbi_s01...
Access XP
WinXP
Adobe Acrobat 5.0

I'm playing with Keri Hardwick's "Save a report's output as a PDF file"

and
most of it still works. The problem is the ChangePdfFileName is not

changing
the file name and it is storing the file in "My Documents" with the

standard
report name. What appears to be going on is that the PDFWriter is not
reading the PDFFilename from the Win.ini. It's reading the PDFFilename

value
from the registry if it exsists. If it doesn't exsist it just uses default values which I don't want.
Here is the code so far:
>>Start Code


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.

Private drexisting As aht_tagDeviceRec
Const AcrobatName = "Acrobat PDFWriter"
Const AcrobatDriver = "PDFWRITR"
Const AcrobatPort = "LPT1:"
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("Acrobat PDFWriter", "PDFFileName",
NewFileName)
End Sub
>>And Here is the trigger for the whole thing:


Private Sub Command6_Click()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "RptDailyPDF"
DoCmd.Close acReport, "RptDailyPDF"
stLinkCriteria = "[ACCT#] = " & "'" & Me![ACCT#] & "'" & "and " &
"[WSDate1] = " & "'" & Me![WSDate1] & "'"

ChangeToAcrobat
ChangePdfFileName ([ACCT#] & Format([WSDate1], "yyyymmdd") & ".PDF")
DoCmd.OpenReport stDocName, acViewNormal, , stLinkCriteria
ResetDefaultPrinter

End Sub
>>End code


Everything works except the file rename like I described. Any help is
appriciated. Also, I haven't posted any questions in a very long time so

if
I've stepped on toes or violated a FAQ rule somewhere, just let me know

and
I'll reform my ways.

Thanks,

Michael Harris
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 10/27/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.532 / Virus Database: 326 - Release Date: 10/28/2003
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.