kamenitxan
New member
- Local time
- Today, 12:30
- Joined
- Jul 8, 2013
- Messages
- 4
Hi,
my report has tens of pages and I need to save each page as separate file with ID as filename.
I searched internets for solution but I something I´m doing wrong. PDF prints with ID but all in one file. I use this code.
Can you help me? Thanks a lot
my report has tens of pages and I need to save each page as separate file with ID as filename.
I searched internets for solution but I something I´m doing wrong. PDF prints with ID but all in one file. I use this code.
Can you help me? Thanks a lot
Code:
Option Compare Database
Private Sub tisk()
Dim cesta As String
Dim kod As String
Dim Sql As String
Dim rs As Recordset
Dim tisknute As String
DoCmd.OpenReport "toner", acViewPreview
cesta = "C:\Documents and Settings\tomas\Plocha\"
kod = Reports![toner].text13
Sql = "SELECT DISTINCT * FROM toner ORDER BY ID"
tisknue = "SELECT ID FROM toner"
Set rs = CurrentDb.OpenRecordset(Sql)
With rs
.MoveLast
.MoveFirst
Do Until .EOF = True
DoCmd.OutputTo acOutputReport, "toner", acFormatPDF, cesta + kod + ".pdf", True
.MoveNext
Loop
End With
rs.Close
End Sub