print a report as individual pdf files

Make the change with the variable. Since it's declared within your procedure, it isn't available to the report.
 
making progress...it runs the report for a single account using the filter i assume. the account its running is in the record set "lettersingleacct" and its the last one on the list. it runs it x amount of times but for the same account. so i get 35 letters of the same account and the account its using is the last one on the recordset list. im thinking its not moving the record set correctly in the loop somehow. i'll mess around with it and see where i get.

i'll check back in a bit.

i added public acctnum As string to the top of the switchboard form where the command23_click is located (where the loop takes places).

Code:
Option Compare Database
Option Explicit
Public acctnum As String
Public Sub Command23_Click()
    Dim MyDB As Database, RS As Recordset
    Dim blRet As Boolean
    Dim strBody As String, lngCount As Long, lngRSCount As Long, FileName As String, strCriteria As String
    
    
    
    Set MyDB = DBEngine.Workspaces(0).Databases(0)
    
    Set RS = MyDB.OpenRecordset _
      ("LetterSingleAcct")
      ' sets recordset to LetterSingleAcct
    lngRSCount = RS.RecordCount
      ' counts number of records in LetterSingleAcct
    If lngRSCount = 0 Then
      MsgBox "No promo email messages to send.", vbInformation
    Else
      RS.MoveLast
      RS.MoveFirst
      
     Do Until RS.EOF
         
           acctnum = RS!portfolio
          
           blRet = ConvertReportToPDF("Letter Single", vbNullString, _
            "C:\" & acctnum & ".pdf", False, True, 150, "", "", 0, 0, 0)
                'runs pdf report
        
          RS.MoveNext
       
                'moves to next recordset
    Loop
    
    End If
    RS.Close
    MyDB.Close
    Set RS = Nothing
    Set MyDB = Nothing
    Close
End Sub
 
Last edited:
I'd rather have that declaration in a standard module, but it should still probably work. I can't see why it would do them all with the last record. Can you post the db?
 
i dont think that is possible. customer account info and such in it. anyways...

i restarted the database and I THINK IT WORKS! impossible! let me make sure...
 
I have the same problem as you have. I can't create single pages from a report with ConvertReportToPDF function from lebans.com. Did you solve your problem?
 
Have you read the whole thread and applied the methods demonstrated? What is your code at this point?
 

Users who are viewing this thread

Back
Top Bottom