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