Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Make an Access97  Report Default to Legal size Landscape.

Posted on 1998-08-06
13
Medium Priority
?
406 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
  • 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 60 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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 …
Suggested Courses

782 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