Problem with report print format

mattpfc

Active Member
Joined
Nov 21, 2002
Messages
299
Hi all,

I am trying to print reports created in Access 2000 on a machine running Access 2003, however none of the reports print in the correct format and all are unreadable.

Any ideas why this may be happening?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
My first guess is a driver problem on the machine - not Access on the unreadable information. Consider converting a COPY of your database to Access2003 and trying again.

On format, I'm taking that to mean things like landscape/portrait.
In A2K there was a problem (known bug I believe) with maintaining print options. Here's one way (for A2K) that you can set it as you print.

I think I made a mistake and didn't keep an attribution notice at the top of this particular copy. Do not consider me the author although this was modified to fit my needs. I think it may have been off the MSDN.

First is how to call the report (for landscape I believe)
Code:
    repName = "repReportName"
    myOrient = 1
    
    Call OpenAssignReport(repName, myOrient)
Code:
Option Compare Database
Option Explicit
        
Type str_DEVMODE
   RGB As String * 94
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 ConvertToLandscape(ByVal strName As Variant, myOrient As Variant)
   Dim rpt As Report
   Dim strDevModeExtra As String
   Dim DevString As str_DEVMODE
   Dim DM As type_DEVMODE
   
   'strName = "repReportName1"
   DoCmd.OpenReport strName, acDesign 'Opens report in Design view.


Set rpt = Reports(strName)

If Not IsNull(rpt.PrtDevMode) Then
   strDevModeExtra = rpt.PrtDevMode
   DevString.RGB = strDevModeExtra
   LSet DM = DevString
   DM.lngFields = DM.lngFields Or DM.intOrientation 'Initialize fields.
   DM.intOrientation = myOrient 'Landscape
   LSet DevString = DM 'Update property.
   Mid(strDevModeExtra, 1, 94) = DevString.RGB
   rpt.PrtDevMode = strDevModeExtra
   DoCmd.Save acReport, strName
   DoCmd.Close acReport, strName
End If

End Function



Public Function OpenAssignReport(ByVal repName As Variant, ByVal myOrient As Variant, _
                        Optional bolPrintOnly As Boolean)

Dim viewPref As VbMsgBoxResult
   
    If Not bolPrintOnly Then
        viewPref = MsgBox("Select Yes if you wish to print.", vbYesNo + vbDefaultButton2, "View or Print")
    End If
    
    Call ConvertToLandscape(repName, myOrient)
    If bolPrintOnly Then viewPref = 6
    Select Case viewPref
        Case 6  'Yes
            DoCmd.OpenReport repName, acNormal, "", ""
            DoCmd.Close acReport, repName
        Case Else  'No
            DoCmd.OpenReport repName, acPreview, "", ""
    End Select

End Function
 
Upvote 0

Forum statistics

Threads
1,221,683
Messages
6,161,264
Members
451,692
Latest member
jmaskin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top