Hi Jeff and thank you for responding.
I will cut and paste the discussions I had with Danny, there weren't that
many so hopefully it won't look too convoluted. Any help you could give would
be much appreciated. Thanks!
It starts off with me answering Danny's question:
Yes.
Danny Seager said:
So once the code has ran what happens when you open the query... is it
displaying the last school in the recordset?
Jeff, I also posted this right after I answered Danny's question.
Jeff Boyce said:
Folks who help out here in the newsgroups do so on a volunteer basis, as
time allows. You might not always hear back from the same person, but you
gain a lot more eyes/brains working on your situation.
Since I wasn't following your earlier post/discussion, consider posting back
a description of your situation, with the added information you mentioned.
Regards
Jeff Boyce
Microsoft Office/Access MVP
Danny,
Also, I wanted to mention that I have not changed the code, in any way,
within the modules or classes, was I supposed to?
Also, I've only placed part of Lebans' code, 'Function ConvertReportToPDF',
within my cmd button code:
Option Compare Database
Option Explicit
' The function call is:
Public Function ConvertReportToPDF( _
Optional strReport As String = "", _
Optional SnapshotName As String = "", _
Optional strDocName As String = "", _
Optional ShowSaveFileDialog As Boolean = False, _
Optional StartPDFViewer As Boolean = True, _
Optional CompressionLevel As Long = 150, _
Optional PasswordOpen As String = "", _
Optional PasswordOwner As String = "", _
Optional PasswordRestrictions As Long = 0, _
Optional PDFNoFontEmbedding As Long = 0, _
Optional PDFUnicodeFlags As Long = 0 _
) As Boolean
End Function
Private Sub cmdReportToPDF_Click()
On Error GoTo Err_cmdReportToPDF_Click
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strReport As String
Dim strDocName As String
Dim blRet As Boolean
Dim strSQLBase As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("qrySchools", dbOpenSnapshot)
strReport = "rptStudentDataSheet_0708"
With rs
Do Until (.EOF Or .BOF) = True
strDocName = "C:\Documents and Settings\anthony.johnson\My
Documents\Anthony\ " & !SiteName & ".pdf"
Dim qdf As DAO.QueryDef
Set qdf = db.QueryDefs("qrySchools")
qdf.SQL = "SELECT * FROM tblStudentDataSheet_0708 WHERE
School= " & rs("School")
qdf.Close
Set qdf = Nothing
blRet = ConvertReportToPDF("strReport", 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
My code still doesn't label and output the files I need. I'm thinking that I
need to change some of the module coding???
Thanks again!!!