Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Losing Page Margin Settings 7

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
0
0
US
Have a queer problem. I just put together several reports and for some reason, after i go to page setup and set the margin parameters for the reports, they seem to lose the settings. the printer used is a HP4050 laserjet on the network. I can get the report in either design or preview mode and then set the margins so all the text lays on the report, then either print (prints fine if i print from preview mode after setting the margins) or save the design and the next time i open the report the margins are all 1" (one inch).

can't understand why this is happening ~ anyone ever had a similar issue??

oh, am using access 2000 (compacting and reopairing has no affect ) also, i tried setting margins on a word2000 document to the same as i am doing in access and have no problem maintaining the settings no matter how many times i open the document in word.

thanks
Paul
 
Paul

I have also noticed this "idiosyncracy". I am also using Access 2000. I print to a variety of HP inkjet and laserjet as well as a Cannon inkjet. I don't think it has anything to do with the printer...?

Mike01
 
actually i found the problem. there is a bug in access2000 that causes this~ found this in the microsoft knowledge base:


ACC2000: Lost Printer Settings When Name AutoCorrect Is Enabled

--------------------------------------------------------------------------------
The information in this article applies to:

Microsoft Access 2000

--------------------------------------------------------------------------------
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access database (.mdb).



SYMPTOMS
A Microsoft Access report suddenly is not formatted as expected. Upon checking the printer settings, you find that they have been reset to their default settings.



CAUSE
This can happen under certain conditions if the Name AutoCorrect feature is enabled.



RESOLUTION
To resolve this problem, obtain Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a).

To obtain SR-1/SR-1a, click the article number below to view the article in the Microsoft Knowledge Base:

Q245025 OFF2000: How to Obtain and Install Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a)
In the Page Setup dialog box, (on the File menu, click Page Setup) reset the values to the settings that you want.

To avoid this problem, disable Name AutoCorrect by following these steps:
On the Tools menu, click Options.


In the Options dialog box, click the General tab.


Click to clear the Perform name AutoCorrect check box.


Click OK.


Quit and then restart Access.

 
Nice discovery Paul. ljprodev@yahoo.com
ProDev
MS Access Applications
 
Yes, but not helpful to me as I have this problem as well, but in Access 97. Have fun! :eek:)

Alex Middleton
 
I've had the same problem in both Acc2K and Acc97. In Acc97 I wound up writing a module to handle letter/legal size and margins - both of which were reverting to default settings.

In part:

The next PrtMip property example shows how to set all margins to 1 inch.

Sub SetMargins(strName As String)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim rpt As Report
DoCmd.OpenReport strName, acDesign
Set rpt = Reports(strName)
PrtMipString.strRGB = rpt.PrtMip
LSet PM = PrtMipString
PM.intLeftMargin = 1 * 1440 ' Set margins.
PM.intTopMargin = 1 * 1440
PM.intRightMargin = 1 * 1440
PM.intBotMargin = 1 * 1440
LSet PrtMipString = PM ' Update property.
rpt.PrtMip = PrtMipString.strRGB

End Sub

Then before you open report call function:

SetMargins ("rpt Inventory Activity")
DoCmd.OpenReport "rpt Inventory Activity", acViewNormal
 
Awesome ... exactly what I was looking for! Have a star, friend!

- Jedi420

A man who has risked his life knows that careers are worthless, and a man who will not risk his career has a worthless life.
 
i get errors on the section
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP

The error is User-Defined type not defined.
Any ideas?
I would really like to fix this page margin inconvienence.



 
You need a couple of Type declarations first. The procedure is the same as evalesthy's above; just different variable names, and it includes parameters for multi-column printing, etc.

(To be honest, I don't understand all of this code - I just know that I used it a couple of years ago. Thanks to the original code contributor! Not sure where I originally found it.)

Type str_PRTMIP
RGB As String * 28
End Type

Type type_PRTMIP
xLeftMargin As Long
yTopMargin As Long
xRightMargin As Long
yBottomMargin As Long
fDataOnly As Long
xItemSizeWidth As Long
yItemSizeHeight As Long
fDefaultSize As Long
xItemsAcross As Long
yColumnSpacing As Long
xRowSpacing As Long
rItemLayout As Long
rFastPrinting As Long
rDataSheetHeadings As Long
End Type

Public Function SetReportMarginDefault(strReportName As String)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim objRpt As Report
Dim tempPrtMip As String

DoCmd.Echo False
DoCmd.openreport strReportName, acDesign
Reports(strReportName).Painting = False
Set objRpt = Reports(strReportName)

PrtMipString.RGB = objRpt.PrtMip

LSet PM = PrtMipString
'Use 1440 for inches
PM.fDefaultSize = False
PM.yTopMargin = 0.3 * 1440
PM.yBottomMargin = 0.2 * 1440
PM.xLeftMargin = 0.7 * 1440
PM.xRightMargin = 0.2 * 1440
PM.xItemsAcross = 3
PM.xRowSpacing = 0
PM.yColumnSpacing = 0.1 * 1440
PM.xItemSizeWidth = 2.35 * 1440
PM.yItemSizeHeight = 0.2076 * 1440
PM.rItemLayout = 1954 ' down, then across

LSet PrtMipString = PM

objRpt.PrtMip = PrtMipString.RGB

'Make sure report has the focus
DoCmd.SelectObject acReport, strReportName
'Save the Report
DoCmd.DoMenuItem 7, acFile, 4, , acMenuVer70

CloseRpt:
DoCmd.Close acReport, strReportName
DoCmd.Echo True

End Function

Of course this example is hard coding in the margins, etc. You could probably adapt it to take the required values as arguments in the function. Hope it helps!

Don
 
This seems to work if you have full access, but will it work when you distribute the applcation (as an .mde) with a run-time?

DoCmd.openreport strReportName, acDesign

is the one it stumbles on.

Can you set it to do landscape or portrait by a similar method to this, or select which printer it prints on?

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top