Change print margins in queries - Access 2010

I've changed the margin settings in "Client Settings" to .25 for all 4 margins.  But every time I print query results, it defaults to 1" margins for all.

How do I change this?
Patty01AccessAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
it works for me if I run the Print Preview the query, right click and select Page Setup and set to 0.25 ...

mx
Capture1.gif
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
0
Patty01AccessAuthor Commented:
I want to set the .25" as the default.  I run a lot of queries that I need to print, and I want it to automatically default to .25" margins so I don't have to redo in page setup everytime.
0
Acronis Data Cloud 7.8 Enhances Cyber Protection

A closer look at five essential enhancements that benefit end-users and help MSPs take their cloud data protection business further.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Well, in A2003 it was easy. That setting seems to have disappeared in A2010 ...


Capture1.gif
0
danishaniCommented:
You could create a User defined function for this, something like this:

Public Function OpenRptPreview(strReport As String)

Dim lngMargin As Long
' in twips 1440 = 1 inch
lngMargin = 320

DoCmd.OpenReport strReport, acViewPreview

With Reports!rptTest.Printer
.TopMargin = lngMargin
.BottomMargin = lngMargin
.LeftMargin = lngMargin
.RightMargin = lngMargin
End With

End Function

Open in new window


Save the Function in seperate Module, then in your database you can use the Function like:

OpenRptPreview("rptYourReportName")

Reports will open with margins set to 0.25 inch in Preview modus.

With this idea you can expand it to have the option with to Print etc.

Hope this helps,
Daniel
0
Patty01AccessAuthor Commented:
I'm sorry, but I don't know much about functions. I'm trying to do this for a query, not a report.

So I pasted the following into a new module:

Public Function OpenQry(strQuery As String)

Dim lngMargin As Long
' in twips 1440 = 1 inch
lngMargin = 320

DoCmd.OpenQuery strQuery, acViewPreview

With Query!qryMetroscanChk      (not sure what to put here, so I put the name of my query)
.TopMargin = lngMargin
.BottomMargin = lngMargin
.LeftMargin = lngMargin
.RightMargin = lngMargin
End With

End Function


But I get the error message "Object Required" and "With Query!qryMetroscanChk" is highlighted, so I know that's wrong.

Please help, and sorry for not knowing more about this!
0
danishaniCommented:
Sorry, my bad, thought you need this for your Report preview.

I am afraid the Query Object doesnt have this properties as far as I know of.

Another option is to use Application.SetOption to set Global variables. Only disadvantage is, it set's the default values for all Forms, Reports, Querys etc. objects to these margines as they are Global. But then you can overwrite them in Reports, using the above function for example.

For example:

Application.SetOption "Left Margin", 0.25
Application.SetOption "Right Margin", 0.25
Application.SetOption "Top Margin", 0.25
Application.SetOption "Bottom Margin", 0.25

Set all margin's to 0.25 inch.

Hope this helps,
Daniel

0
Jeffrey CoachmanMIS LiasonCommented:
Patty01Access,


...Then why not just create a simple Report (That will look just like the query) and print that...?
Then what you are requesting is ridiculously simple.

And you will also gain all the other advantages of using a report.
Headers, Footer, Code control, Page breaks, page numbering, more extensive formatting, Grouping, ...etc
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
I think the bottom line here is ... if ... you want to control the margins, you will need to use a Report.

mx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
MX,

Yeah, I Think I remember a way to do what they are asking for, ...but I agree,
I see no reason why a simple report could not be created...

Enjoy the weekend buddy...

Jeff
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
see images ....
Capture1.gif
Capture2.gif
0
Patty01AccessAuthor Commented:
I prefer using the query because I change a lot of criteria and sorting.  And I use this query a lot.  So that's why I don't want to do it as a report.

So looks like the bottom line is you can't set the default margins for a query, which seems ridiculous.

Oh well, maybe in Access 2020.

0
Patty01AccessAuthor Commented:
Wish there was someone who knew how to do this, but seems like Access just won't let you do it in an easy enough way.  What a shame.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.