Solved

Make an Access97  Report Default to Legal size Landscape.

Posted on 1998-08-06
13
401 Views
Last Modified: 2011-04-14
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
Comment
Question by:ewalsh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
13 Comments
 
LVL 5

Expert Comment

by:kulikuli
ID: 1958310
Check the defaultview property in the form's property sheet to have a form displayed in datasheet view

Best regards,

kulikuli
0
 
LVL 5

Expert Comment

by:kulikuli
ID: 1958311
sorry for that comment - I posted it in the wrong question
0
 
LVL 1

Accepted Solution

by:
sfranks earned 30 total points
ID: 1958312

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ewalsh
ID: 1958313
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
 
LVL 1

Expert Comment

by:sfranks
ID: 1958314
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
 

Author Comment

by:ewalsh
ID: 1958315
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
 
LVL 1

Expert Comment

by:sfranks
ID: 1958316
oppps, sorry about that.  Just add the keyword "public" before the sub procedure.

0
 

Author Comment

by:ewalsh
ID: 1958317
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
 
LVL 1

Expert Comment

by:sfranks
ID: 1958318
Ack!  Too much cut, copy, paste.  

Call SwitchOrient("rptVT_Others")

0
 

Author Comment

by:ewalsh
ID: 1958319
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
 

Author Comment

by:ewalsh
ID: 1958320
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
 
LVL 1

Expert Comment

by:sfranks
ID: 1958321
just comment out that line...   I don't think you actually have to open the report.


0
 
LVL 1

Expert Comment

by:sfranks
ID: 1958322
hmmmm,  I would try the report header onPrint event.  
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question