Printing Preference

C

ChoonBoy

I have a Form with one Button (print) and an Option Group with 4 options.

Option 1 (Print with top Margin 5")
Option 2 (Print with top Margin 3")
Option 3 (Print with top Margin 2")
Option 4 (Print with top Margin 1")

When the Button is clicked and depending on the Option selection, the A4
text printout should reflect the selected Margin.

It is not possible to use Page Setup because the Margin goes back to
default each time the MDE program starts.

Thanks for any help.
 
J

Jack Leach

If you're in Access 2003 or later you can use the Printer object to modify
these settings. Versions before require API usage and can be found at
mvps.org/access

Search the web for how to use the Printer object, there's a number of
tutorials

Have fun :)
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
C

ChoonBoy

Thanks for the reply, I am using A03 and A07.

I visited your suggested sites. The printer object is quite difficult, is
there an easier method for this task.

Regards
 
J

Jack Leach

The printer object is quite difficult

I agree... unfortunately I think this is the only way you can
programmatically edit this. If I was good enough using it I'd try to give an
example but it would most likely be a major headache for both of us. Maybe
someone else can jump in with some advice.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
C

ChoonBoy

Thanks Jack for the effort.

Regards

Jack Leach said:
I agree... unfortunately I think this is the only way you can
programmatically edit this. If I was good enough using it I'd try to give an
example but it would most likely be a major headache for both of us. Maybe
someone else can jump in with some advice.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
M

Michael J. Strickland

Assuming you are setting margins for an existing report, you might try:

---------------------------------------------------

Const mconstTwipsPerInch = 1440 ' Twips per inch

Dim lngTopMargin as long
Dim strReportName as string ' your report name
Dim rpt As Report ' Report object

DoCmd.OpenReport strReportName, acViewDesign
Set rpt = Reports(strReportName)

rpt.Visible = False
rpt.Printer.TopMargin = lngTopMargin * mconstTwipsPerInch

DoCmd.Close acReport, strReportName, acSaveYes

---------------------------------------------------

where:
strReport is your report name
lngTopMargin is your top margin in inches

The above code sets the margin to lngTopMargin inches.

You would probably need a case statement in the option frame AfterUpdate
event to set lngTopMargin depending on which option button is selected.
 
C

ChoonBoy

Thanks for the reply Micheal, I will give it a try.

Will this work once I convert it to MDE?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top