Dynamic Page Margins

  • Thread starter Thread starter Vel
  • Start date Start date
V

Vel

Hello,

I have a report which must print out on a paper form.
However, occasionally the forms are cut just a bit
differently, causing me to need to 'nudge' the text a
hair to the right, left, up, or down. I would like to be
able to print an alignment of the report and then, if
necessary, enter into a dialog box or a form a number of
points, positive or negative, to add or subtract from the
default margins. Is there a property on the form which
can be dynamically altered to do this?

Thanks,

Vel.
 
Hello,

I have a report which must print out on a paper form.
However, occasionally the forms are cut just a bit
differently, causing me to need to 'nudge' the text a
hair to the right, left, up, or down. I would like to be
able to print an alignment of the report and then, if
necessary, enter into a dialog box or a form a number of
points, positive or negative, to add or subtract from the
default margins. Is there a property on the form which
can be dynamically altered to do this?

Thanks,

Vel.

You can use the PrtMip property to change margins, etc. of a report.
But you must open the report in Design View (you can use code) to do
so.

Look up the PrtMip property in VBA help.
The second example show how to change margins.
 
Vel said:
I have a report which must print out on a paper form.
However, occasionally the forms are cut just a bit
differently, causing me to need to 'nudge' the text a
hair to the right, left, up, or down. I would like to be
able to print an alignment of the report and then, if
necessary, enter into a dialog box or a form a number of
points, positive or negative, to add or subtract from the
default margins. Is there a property on the form which
can be dynamically altered to do this?


Form? You're not trying to print a form are you??

Reports (and form) objects in A2002 and later have a Printer
Property. The returned object has many properties including
the four margins. See Help for details.
 
Alright, I managed to get the margins to change dynamically like I wanted,
but I still have a minor problem. How do I close the design view using code.
I'm sure it's a simple matter, but I've never had to have anything open in
design view for user functionality before so it's never come up. The
Docmd.Close command just closes the form open in preview mode, not design
view, so...

Thanks Again
 
Alright, I managed to get the margins to change dynamically like I wanted,
but I still have a minor problem. How do I close the design view using code.
I'm sure it's a simple matter, but I've never had to have anything open in
design view for user functionality before so it's never come up. The
Docmd.Close command just closes the form open in preview mode, not design
view, so...

Thanks Again

re: > The Docmd.Close command just closes the form open in preview
mode, not design view, so... <

Not so.
DoCmd.Close has arguments. It will close whatever you tell it to.

Just close the report, and save as acSaveYes to avoid a prompt.

DoCmd.Close acReport, "ReportName", acSaveYes
 
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.
 
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
 
Back
Top