A
Antney
Can anyone help me out with this???!!!
I finally figured out how to convert my Access reports to PDF, thanks
Stephen, but it's not separating the schools into their own PDFs. It
separates the PDFs by their school name, which is great and what I want, but
ALL of the schools are in each PDF file!
I need only that school in its' own PDF file.
Also, I'd like to reset my query at the end, if that's possible?
I DID NOT change any of Stephen's code in his modules or class!
Here is my code behind my command print button:
Option Compare Database
Option Explicit
Private Sub cmdReportToPDF_Click()
On Error GoTo Err_cmdReportToPDF_Click
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rptStudentDataSheet_0708 As String
Dim strDocName As String
Dim blRet As Boolean
Dim strSQLBase As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("qrySchools", dbOpenSnapshot)
With rs
Do Until (.EOF Or .BOF) = True
Dim qdf As DAO.QueryDef
'strReport = "rptStudentDataSheet_0708"
strDocName = "C:\Documents and Settings\anthony.johnson\My
Documents\Anthony\ " & !SiteName & ".pdf"
Set qdf = db.QueryDefs("qrySchools")
qdf.SQL = "SELECT * FROM tblStudentDataSheet_0708 WHERE
School= " & rs("School")
qdf.Close
Set qdf = Nothing
blRet = ConvertReportToPDF("rptStudentDataSheet_0708",
vbNullString, strDocName, False, False, 150, "", "", 0, 0, 0)
rs.MoveNext
Loop
End With
Exit_cmdReportToPDF_Click:
'Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
db.Close: Set db = Nothing
Exit Sub
Err_cmdReportToPDF_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in Test subroutine..."
Resume Exit_cmdReportToPDF_Click
End Sub
Here is Stephen Lebans' module code:
I finally figured out how to convert my Access reports to PDF, thanks
Stephen, but it's not separating the schools into their own PDFs. It
separates the PDFs by their school name, which is great and what I want, but
ALL of the schools are in each PDF file!
I need only that school in its' own PDF file.
Also, I'd like to reset my query at the end, if that's possible?
I DID NOT change any of Stephen's code in his modules or class!
Here is my code behind my command print button:
Option Compare Database
Option Explicit
Private Sub cmdReportToPDF_Click()
On Error GoTo Err_cmdReportToPDF_Click
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rptStudentDataSheet_0708 As String
Dim strDocName As String
Dim blRet As Boolean
Dim strSQLBase As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("qrySchools", dbOpenSnapshot)
With rs
Do Until (.EOF Or .BOF) = True
Dim qdf As DAO.QueryDef
'strReport = "rptStudentDataSheet_0708"
strDocName = "C:\Documents and Settings\anthony.johnson\My
Documents\Anthony\ " & !SiteName & ".pdf"
Set qdf = db.QueryDefs("qrySchools")
qdf.SQL = "SELECT * FROM tblStudentDataSheet_0708 WHERE
School= " & rs("School")
qdf.Close
Set qdf = Nothing
blRet = ConvertReportToPDF("rptStudentDataSheet_0708",
vbNullString, strDocName, False, False, 150, "", "", 0, 0, 0)
rs.MoveNext
Loop
End With
Exit_cmdReportToPDF_Click:
'Cleanup
On Error Resume Next
rs.Close: Set rs = Nothing
db.Close: Set db = Nothing
Exit Sub
Err_cmdReportToPDF_Click:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in Test subroutine..."
Resume Exit_cmdReportToPDF_Click
End Sub
Here is Stephen Lebans' module code: