Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

Make an Access97 Report Default to Legal size Landscape.

I have a application I created in Access 97 & have it loaded on the server with 5+ stations using it.  They all have a local printer & a network printer.  They use local printer for small print jobs & network for larger ones. My problem is, I have reports that run on Legal size paper Landscape.  But when they change printers, it resets the reports to letter size landscape.  Is there a way to stop this?  Can it be automaticly set set no matter if you change printers?  This would seem like an easy answer but I can't figure it out!
Any help is appreciated.
Thank you.

Ed W.
0
Ed Walsh
Asked:
Ed Walsh
  • 6
  • 5
  • 2
1 Solution
 
kulikuliCommented:
Check the defaultview property in the form's property sheet to have a form displayed in datasheet view

Best regards,

kulikuli
0
 
kulikuliCommented:
sorry for that comment - I posted it in the wrong question
0
 
sfranksCommented:

Here ya go....   you can just add this code to the onPrint event of the report.

If this doesn't work or you have problems just let me know.

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

Sub SwitchOrient(strName As String)
      Const DM_PORTRAIT = 1
      Const DM_LANDSCAPE = 2
      Dim DevString As str_DEVMODE
      Dim DM As type_DEVMODE
      Dim strDevModeExtra As String
      Dim rpt As Report
      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.

If DM.intOrientation = DM_PORTRAIT Then
                  DM.intOrientation = DM_LANDSCAPE
            End If
            LSet DevString = DM                                    ' Update property.
            Mid(strDevModeExtra, 1, 94) = DevString.RGB
            rpt.PrtDevMode = strDevModeExtra
      End If
End Sub

0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
Ed WalshAuthor Commented:
When I put this code in a Sub Procedure in Event "OnPage" of my report I get this error message.

Compile Error:Invalid Inside Procedure.

It is then highlights this line of code:

Type str_DEVMODE

Help!
0
 
sfranksCommented:
Not too familiar with VBA eh....    alright then.....  

Okay well when I said that you should add this code to the onPrint event what I meant
really was a call to this code.  So in the onPrint event you should say

call SwitchOrient("YourREPORTName" As String)

the rest of the code should be put into a module so....

go to the module tab.....  click new....  copy the code that I previously gave you and
paste it after the option explicit statement.  That should be it....  


0
 
Ed WalshAuthor Commented:
Ok, I made a module & saved it as "Print on Legal paper and Landscape.

I put call SwitchOrient("rptVT_Others" As String) in OnPrint.
And ran it.  Got an error message.
"Diary Daily Reports can't find the Macro."

I then tried
=call SwitchOrient("rptVT_Others" As String)
=SwitchOrient("rptVT_Others" As String)
SwitchOrient("rptVT_Others" As String)

No luck, same error message.
0
 
sfranksCommented:
oppps, sorry about that.  Just add the keyword "public" before the sub procedure.

0
 
Ed WalshAuthor Commented:
Ok, I made a module & saved it as "Print on Legal paper and Landscape.

I put call SwitchOrient("rptVT_Others" As String) in OnPrint.
And ran it.  Got an error message.
"Diary Daily Reports can't find the Macro."

I then tried
=call SwitchOrient("rptVT_Others" As String)
=SwitchOrient("rptVT_Others" As String)
SwitchOrient("rptVT_Others" As String)

No luck, same error message.
0
 
sfranksCommented:
Ack!  Too much cut, copy, paste.  

Call SwitchOrient("rptVT_Others")

0
 
Ed WalshAuthor Commented:
Ok, I placed Call SwitchOrient("rptVT_Others") in OnPrint.

I saved it & tried to run it. I get this error message.
Run-Time Error '2046':
The command or action 'OpenReport'  isn't available now.
I then click DEBUG button & this line of code is highlighted.

DoCmd.OpenReport strName, acDesign ' Opens report in Design view.

If it makes a difference.  The table that this report is getting its info from is a Linked Foxpro 2.5 Table.  I have full rights to it.

Ed W.
0
 
Ed WalshAuthor Commented:
One other note.

OnPrint Event.  I noticed that this event can be different for different Sections of the report. Ect, Page header/Footer, Report Header Footer,GroupHeader/GroupFooter ect.
Where should it go?
In the events for the whole report there is no OnPrint Event.
Only:
On Open, On Close, On Activate, On DeActivate, On NoData, On Page, On Error.

I'm a bit confused on the proper place to put the
Call SwitchOrient("rptVT_Others").
0
 
sfranksCommented:
just comment out that line...   I don't think you actually have to open the report.


0
 
sfranksCommented:
hmmmm,  I would try the report header onPrint event.  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 6
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now