M
Macsmasher
Running Access 2003.
I have a form that I want to print preview. When I when I fire my code from
the cmd button, it works fine It calls a sub that positions the controls and
sets the color for printing. But upon closing the print preview, I need to
run another Sub to reset the colors and reposition the controls. The problem
is, there is no Event for returning from print preview in which to call the
subs. So, when I come back to the form, everything is messed up from the
print.
Here is my code that fires from the cmd button on the form:
Private Sub cmdPrint_Click()
PrepareToPrint True 'calls a sub that formats colors and backgrounds.
Call FormatPortrait 'positions controls on form for portrait printing
Me.Printer.Orientation = acPRORPortrait
Me.Printer.PaperSize = acPRPSLetter
DoCmd.OpenForm "frmDrawSummary", acPreview
PrepareToPrint False 'Turns off the formatting for printing.
Call FormatLandscape 'Reset form controls back to their original
positions
End Sub
Basically, the last two lines don't fire. I've tried placing them in other
form Events like got focus, activate, etc. to no avail.
Just a side note...if I just print a hard copy with [DoCmd.PrintOut
acPrintAll] instead of [DoCmd.OpenForm "frmDrawSummary", acPreview],
everything runs fine.
Any help would be muchly appreciated!
-Larry
I have a form that I want to print preview. When I when I fire my code from
the cmd button, it works fine It calls a sub that positions the controls and
sets the color for printing. But upon closing the print preview, I need to
run another Sub to reset the colors and reposition the controls. The problem
is, there is no Event for returning from print preview in which to call the
subs. So, when I come back to the form, everything is messed up from the
print.
Here is my code that fires from the cmd button on the form:
Private Sub cmdPrint_Click()
PrepareToPrint True 'calls a sub that formats colors and backgrounds.
Call FormatPortrait 'positions controls on form for portrait printing
Me.Printer.Orientation = acPRORPortrait
Me.Printer.PaperSize = acPRPSLetter
DoCmd.OpenForm "frmDrawSummary", acPreview
PrepareToPrint False 'Turns off the formatting for printing.
Call FormatLandscape 'Reset form controls back to their original
positions
End Sub
Basically, the last two lines don't fire. I've tried placing them in other
form Events like got focus, activate, etc. to no avail.
Just a side note...if I just print a hard copy with [DoCmd.PrintOut
acPrintAll] instead of [DoCmd.OpenForm "frmDrawSummary", acPreview],
everything runs fine.
Any help would be muchly appreciated!
-Larry