Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

vb crystal ocx printing landscape

Posted on 2002-03-21
8
Medium Priority
?
454 Views
Last Modified: 2007-12-19
Please help
I need to be able to tell the crystl32.ocx
to print a report designed in landscape in landscape.
But the view/print is always landscape

Is there a hidden function paramter something that I cannot find.

Otherwise what is the alternative, i have done 168 reports and do not want to change them.
Also they have parameter fields which need to be set at runtime - have done this OK

many thanks

paul cooper
paul@pcdevelopments.co.uk
0
Comment
Question by:pcdev
[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
  • 4
  • 4
8 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 6885823
try crRpt.PaperOrientation = crLandscape

PaperOrientation - CRPaperOrientation. Gets or sets the current printer paper orientation. For the default printer, crDefaultPaperOrientation is returned. Read/Write Can be written only when formatting idle.
crDefaultPaperOrientation     0
crLandscape     2
crPortrait     1
0
 

Author Comment

by:pcdev
ID: 6885852
Thanks for you comments on experts exchange
however using crRpt.PaperOrientation = crLandscape

and crRpt.PaperOrientation = 2
I get


438 - Object doesn't support this property or method
Any other options?
VB6
SP5
Crystal OCX v 8.0.0.4 from 8.5 developer

many thanks
0
 

Author Comment

by:pcdev
ID: 6885864
Thanks for you comments on experts exchange
however using crRpt.PaperOrientation = crLandscape

and crRpt.PaperOrientation = 2
I get


438 - Object doesn't support this property or method
Any other options?
VB6
SP5
Crystal OCX v 8.0.0.4 from 8.5 developer

many thanks
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 18

Expert Comment

by:bobbit31
ID: 6885893
can you post your code for when you open the report
0
 

Author Comment

by:pcdev
ID: 6885905
Private Sub cmdPrint_Click()
    On Error GoTo cmdPrint_Click_Error
   
'    MsgBox "This program is in debug mode, please be patient"
    Dim iFormulaCount As Integer
    Dim iSplit As Integer
    sReportConnect = "dsn=" & sDSN & _
                    ";UID=" & sUser & _
                    ";Pwd=" & sPassword
   
   
   
       
    'Get Report Name
    Dim sReportFileName As String
    List1.ListIndex = 0
    sReportFileName = List1
   
    'Get Printer Name
    Dim sReportPrinterName As String
    List1.ListIndex = 1
    sReportPrinterName = List1
   
    'Get Printer Driver
    Dim sReportPrinterDriver As String
    List1.ListIndex = 2
    sReportPrinterDriver = List1
   
    Dim iParamNum As Integer
   
   
    With CR1
       
        .ReportFileName = sReportFileName
        '.SelectionFormula = sSQL
        .Connect = sReportConnect
        .PrinterName = sReportPrinterName
        .PrinterPort = sReportPrinterName
        .PrinterDriver = sReportPrinterName
        '.Orientation = 2
        .PaperOrientation = 2
        If chkPreview = vbChecked Then
            .Destination = crptToWindow
        Else
            .Destination = crptToPrinter
        End If
'        .DiscardSavedData = False
       
        'Blank Formulas
        For iFormulaCount = 0 To 99
            .ParameterFields(iFormulaCount) = ""
        Next
       
       
        'Get Parameters
        iParamNum = 0
        iSplit = 1
        Do Until List1.ListIndex = List1.ListCount - 1
            List1.ListIndex = List1.ListIndex + 1
                pArray = Split(List1, "=", , vbTextCompare)
                For Each p In pArray
                    If iSplit = 2 Then
                        .ParameterFields(iParamNum) = "Param" & iParamNum + 1 & ";" & p & ";True"
                        iParamNum = iParamNum + 1
                        iSplit = 1
                    Else
                        iSplit = iSplit + 1
                    End If
                       
                Next

        Loop
'        .Formulas(iFormula) = "Form" & iFormula + 1 & " = '" & List1 & "'"
'        .ParameterFields(0) = "a1;Hello World;True"
        .Action = 1
    End With
'    End
    Exit Sub
cmdPrint_Click_Error:
    MsgBox Err & " - " & error & " - frmScanPrint"
    Exit Sub
End Sub






0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6886021
why not use CRAXDRT (projects/references/crystal activex designer runtime library)

then you can do something like:

Dim CR as new CRAXDRT.Application
Dim myRpt as CRAXDRT.Report

set myRpt = CR.openReport("<file name>")

myRpt.EnableParameterPrompting = False

'' pass your parameters in
myRpt.ParameterFieldDefinitions.Item(<index>).setCurrentValue "<value>"

'' set printer orientaiton
myRpt.PaperOrientation = crLandscape

myRpt.PrintOut







0
 
LVL 18

Accepted Solution

by:
bobbit31 earned 200 total points
ID: 6886032
ps: the crystl32.ocx is old (ever since cr4.5)... the craxdrt was introduced in v7 and should be used. (you can do everything you can do in the ocx plus more)
0
 

Author Comment

by:pcdev
ID: 6886066
Mate your a diamond, will do this and let you know.
Just always stuck with the OCX coz it worked in the past
Many thanks

Job well done and very quickly

Paul Cooper
paul@pcdevelopments.co.uk
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

610 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