PC Review


Reply
Thread Tools Rate Thread

Call ConvertReportToPDF

 
 
Antney
Guest
Posts: n/a
 
      10th Jul 2008
Hi,

How do I call 'Call ConvertReportToPDF'? Everytime I run this code, I get
the 'Sub or Function not defined.

Also, will this take care of the reports naming? When I comment out the
'Call ConvertReportToPDF' and run the code, it runs ok but my reports still
do not get named correctly, I have to manually type them in. The 'SiteName',
in my code, is in the query and table that I am using so I can't figure out
why they're not automatically being named.

Thank you!

Here's my code:

Option Compare Database
Option Explicit

Private Sub cmdPrintReports_Click()
On Error GoTo Err_cmdPrintReports_Click

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strReport As String
Dim strDocName As String

Set db = CurrentDb()
Set rs = db.OpenRecordset("qrySchools", dbOpenSnapshot)
strReport = "rptStudentDataSheet_0708"

With rs
Do Until (.EOF Or .BOF) = True
DoCmd.OpenReport strReport, acViewNormal, , "School = " &
rs("School")
Reports(strReport).Visible = False
strDocName = "C:\Documents and Settings\anthony.johnson\My
Documents\Anthony\ " & !SiteName & ".pdf"
Call ConvertReportToPDF(strReport, , strDocName, False, False)
DoCmd.Close acReport, strReport
rs.MoveNext
Loop
End With

Exit_cmdPrintReports_Click:
'Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
db.Close: Set db = Nothing
Exit Sub

Err_cmdPrintReports_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in Test subroutine..."
Resume Exit_cmdPrintReports_Click
End Sub


 
Reply With Quote
 
 
 
 
Albert D. Kallal
Guest
Posts: n/a
 
      10th Jul 2008
does your code compile?

While looking at the code (and, it looks ok), go debug->compile....

There is some additional instructions and notes here
http://www.lebans.com/reporttopdf.htm

I would perhaps download the latest version of this pdf software......and
take a quick read of the above notes....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ConvertReportToPDF Peter Kinsman Microsoft Access Reports 0 23rd Mar 2009 07:10 PM
ConvertReportToPDF - Someone Help Please!!! Antney Microsoft Access VBA Modules 7 15th Jul 2008 09:37 PM
Help on ConvertReportToPDF Ana Paula Shimmer Microsoft Access Reports 2 10th Mar 2008 12:03 PM
Help on ConvertReportToPDF Ana Paula Shimmer Microsoft Access 2 10th Mar 2008 12:02 PM
Help on ConvertReportToPDF Ana Paula Shimmer Microsoft Access Security 0 7th Mar 2008 06:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:23 PM.