Page setup not holding

kavarin

Registered User.
Local time
Today, 05:56
Joined
Apr 4, 2002
Messages
60
I have several reports that have a unique problem. When I access the report on my system (design mod's, etc) and I go into page setup, I save the margin and paper layout settings without a problem.....but when the user I created this system for opens the report, it reverts back to 1 inch around on the margins, and the paper returns to Letter size, Portrait orientatiuon (which I am assuming is the default)

Any idea what I am missing? I have several other Access systems that I do not encounter this problem in. The ONLY difference is that this user IS NOT a member of the workgroup security file. Could that be an issue?
 
A workaround would be to set the page properties each time the report is opened. the time for Access vba to do this is insignificant.
 
If this is A2k remeove the Auto correct option
 
Thanks for the suggestions. Unfortunately, neither works here? I cannot understand why this report will not keep it's formating...but who knows
 
I am very UNFAMILIAR with vba programming. Would it be a difficult task to format the report on entry? Can it be an automated task, as the users are DANGEROUS if I give them formatting control :-)
 
When you set the page margins, do you go into Design view? That seems to keep them for me.
 
Yes. I am in Design View / Page Setup. I don't know what else to try

:-(
 
VBA Code to set report print characteristics

Create a new module and paste the following:


Option Compare Database
Option Explicit

Type str_DEVMODE
RGB As String * 94
End Type

Type str_PRTMIP
strRGB As String * 28
End Type

Type type_PRTMIP
intLeftMargin As Integer
intTopMargin As Integer
intRightMargin As Integer
intBotMargin As Integer
intDataOnly As Integer
intWidth As Integer
intHeight As Integer
intDefaultSize As Integer
intColumns As Integer
intColumnSpacing As Integer
intRowSpacing As Integer
intItemLayout As Integer
intFastPrint As Integer
intDatasheet As Integer
End Type


Type type_DEVMODE
strDeviceName As String * 16
intSpecVersion As Integer
intDriverVersion As Integer
intSize As Integer
intDriverExtra As Integer
lngFields As Long
intOrientation As Integer
intPaperSize As Integer
intPaperLength As Integer
intPaperWidth As Integer
intScale As Integer
intCopies As Integer
intDefaultSource As Integer
intPrintQuality As Integer
intColor As Integer
intDuplex As Integer
intResolution As Integer
intTTOption As Integer
intCollate As Integer
strFormName As String * 16
lngPad As Long
lngBits As Long
lngPW As Long
lngPH As Long
lngDFI As Long
lngDFr As Long
End Type

Public Function CheckCustomPage(rptName As String, nPaperSize, nOrientation)

Dim DevString As str_DEVMODE
Dim DM As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim intResponse As Integer
' Opens report in Design view.
Application.Echo False
DoCmd.OpenReport rptName, acDesign

Set rpt = Reports(rptName)
If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode ' Gets current DEVMODE structure.
DevString.RGB = strDevModeExtra
LSet DM = DevString
DM.lngFields = DM.lngFields Or DM.intPaperSize Or DM.intOrientation
DM.intPaperSize = nPaperSize ' Set custom page.
' Prompt for length and width.
If DM.intOrientation <> nOrientation Then
DM.intOrientation = nOrientation
End If
LSet DevString = DM ' Update property.
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
End If
PrtMipString.strRGB = rpt.PrtMip
LSet PM = PrtMipString
PM.intLeftMargin = 0.166 ' Set margins.
PM.intTopMargin = 0.25
PM.intRightMargin = 0.166
PM.intBotMargin = 0.25
LSet PrtMipString = PM ' Update property.
rpt.PrtMip = PrtMipString.strRGB

DoCmd.Close acReport, rptName
Set rpt = Nothing
Application.Echo True
End Function

*************************************************
From the command button, Call the report thusly:
*************************************************
Dim RetVal As Variant
Dim rpt as String

Const DM_LEGAL = 5
Const DM_PORTRAIT = 1
Const DM_LANDSCAPE = 2

DoCmd.SetWarnings False
RetVal = CheckCustomPage(rpt, DM_LEGAL, DM_PORTRAIT)
DoCmd.SetWarnings True

DoCmd.OpenReport rpt, acViewPreview
 
simple

I am pretty bad, but where exactly do i call the specific report from the code you provided from the command button...

very very new to code... thanks
 

Users who are viewing this thread

Back
Top Bottom