Can anyone help me with printing a report to pdf files?
Basically I have to produce individual pdf information sheets for each of a long list of report's pages.
I am try with "rtf" suffix, since I am a beginner with Access and programming.
The code is, but I get run-time 13 error:
Private Sub PagetoPDF_Click()
Dim dbf As DAO.Database
Dim rst As DAO.Recordset
Dim strFileName As String
Dim strPathName As String
strPathName = "D:\BovLux\" 'path to change
Set dbf = CurrentDb
Set rst = dbf.OpenRecordset("Invoice") 'Qry Invoice
With rst
If .RecordCount = 0 Then
MsgBox "There are no detailss to print"
Else
.MoveLast
.MoveFirst
Do While Not .EOF
strFileName = strPathName & ![IDOrder] & "_" * ![LastName] '& ".rtf" '-->>>RUN TIME 13 Error
DoCmd.OutputTo acOutputReport, acFormatRTF, strFileName
.MoveNext
Loop
.Close
End If
End With
Set rst = Nothing
End Sub
Thanks for your help.
Regards
John
Basically I have to produce individual pdf information sheets for each of a long list of report's pages.
I am try with "rtf" suffix, since I am a beginner with Access and programming.
The code is, but I get run-time 13 error:
Private Sub PagetoPDF_Click()
Dim dbf As DAO.Database
Dim rst As DAO.Recordset
Dim strFileName As String
Dim strPathName As String
strPathName = "D:\BovLux\" 'path to change
Set dbf = CurrentDb
Set rst = dbf.OpenRecordset("Invoice") 'Qry Invoice
With rst
If .RecordCount = 0 Then
MsgBox "There are no detailss to print"
Else
.MoveLast
.MoveFirst
Do While Not .EOF
strFileName = strPathName & ![IDOrder] & "_" * ![LastName] '& ".rtf" '-->>>RUN TIME 13 Error
DoCmd.OutputTo acOutputReport, acFormatRTF, strFileName
.MoveNext
Loop
.Close
End If
End With
Set rst = Nothing
End Sub
Thanks for your help.
Regards
John