I have a report going directly to a pdf file:
Code:
DoCmd.OutputTo acOutputReport, rptName, acFormatPDF, PDFName
The report in fact renders and is written to the pdf file "PDFName". The OnPage event code is as follows:
Code:
Option Compare Database
Dim PgNo As Variant
Dim strTemp As String
Dim HdrPgAdj As Integer
Dim I As Integer
Dim intShift As Integer
Dim intShiftAMt As Integer
<snip>
Private Sub Report_Open(Cancel As Integer)
Dim strCoverName As String
intShiftAMt = 780 '0.5417 (design position) x 1440
PgNo = 0
intShift = 0 '1st 3 pages there's no shifting
<snip>
End Sub
Private Sub Report_Page()
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
' Starting with the 4th page and alternately thereafter, we shift the page controls
' left;restore;left;restore;............ etc. Given page binding on the left edge
' of the book, the duplex (both sides") printing will better position the back side.
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
If pgn < 3 Then
pgn = pgn + 1
Exit Sub
End If
For I = 1 To 10
Me.Controls("lblLn" & I).left = Me.Controls("lblLn" & I).left + intShift
Next I
Me.Image0.left = Me.Image0.left + intShift
Me.ImageBox.left = Me.ImageBox.left + intShift
If intShift = 0 Then '1st nominal design position?
intShift = -intShiftAMt 'Next page we shift to the left
Else
If intShift < 0 Then
intShift = intShiftAMt
Else
intShift = -intShiftAMt
End If
End If
End Sub
The report is 2 columns. Below is a design view screenshot of the Detail section.
EDIT: pgn is a typo, should be "Pgno". code proceeds to where shift code should run but nothing seems to happen and none of the error traps fire.
EDIT2: I can't even get a debug a Breakpoint to fire, though simple Msgbox statements to fire announcing I'm in the code are working.