What event should I put that code in? Here's how I have it set up. Upon
clicking the 'print' button on my form.
1 The form becomes invisible (allowing the fields on the form to still be
used as
parameters to send to various bits of the report)
2 The report opens in design view and the margins are modified.
3 The report opens in print preview mode to allow the user to check the
data prior
to printing.
4 When the report is printed a dialog box pops up asking if it printed
correctly (if so
then some fields in the table are updated, if not they are not).
5 When the report closes the original form reopens.
--The report is still open in design view in the background.--
Vel.
p.s. I assume I want to do:
docmd.Close, acReport, stName, acSaveNo if I want to preserve the default
margins, where stName is the name of the open report.
I just don't know where to place that line of code. It won't let me put it
in the report's OnClose event, and it didn't seem to fire on the form's
OnActivate.
1 The form becomes invisible (allowing the fields on the form to
still be
used as
parameters to send to various bits of the report)
2 The report opens in design view and the margins are modified.
3 The report opens in print preview mode to allow the user to check the
data prior
to printing.
4 When the report is printed a dialog box pops up asking if it printed
correctly (if so
then some fields in the table are updated, if not they are not).
5 When the report closes the original form reopens.
--The report is still open in design view in the background.--
1) The first thing you need to do is open the report in design view.
2) Make the setup changes you want.
3) Close the report and save the changes.
4) Open the report, this time in preview.
5) Hide the form
6) When the report is printed a dialog box pops up asking if it
printed correctly (if so then some fields in the table are updated,
if not they are not).
7) Close the report.
8) Close the form (or make it visible again)
Item # 1 to 5 is done from the Form button's Click event you are using
to open the report.
DoCmd.OpenReport "ReportName", acViewDesign, , , acHidden
' Make your report changes here
DoCmd.Close acReport, "ReportName", acSaveYes
DoCmd.OpenReport "ReportName", acViewPreview
Me.Visible = False
Item # 6 is done by some event in the report or somewhere else. I have
no idea how you are doing this or what.
Item # 7 is done automatically when you print the report, or manually,
if you preview the report, by clicking the 'Close' toolbutton on the
Print Preview tool bar.
Item #8 should be done in the Report's Close event.
DoCmd.Close acForm, "FormName"
Or.. instead of closing the form if you wish to make it visible again,
use:
forms!FormName.Visible = True