2 Replies - 208 Views - Last Post: 07 February 2012 - 09:01 AM Rate Topic: -----

Topic Sponsor:

#1 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 72
  • Joined: 11-March 11

Issue with printing - Converted vb6//vb.net program

Posted 07 February 2012 - 08:28 AM

Hello,

I'm currently stuck on trying to fix this printing function on a project i'm working on, i've been trying for quite some time now with no good results. Keep in mind this is an in-house program with non-standard ways of programming, hence I fully expect to not get an answer if it's just too far complicated to understand with a block of code.

With CrystalReport2
                .Connect = oItemUtil.oDBItem.CrystalRptConnection 'sReportConnect

                Select Case oItemUtil.AccountType
                       Case "Comm"                                                                                                                                .ReportFileName = My.Application.Info.DirectoryPath & "\Reports\item.rpt"
                    Case Else
                        .ReportFileName = My.Application.Info.DirectoryPath & "\Reports\item2.rpt"
                End Select

                .SelectionFormula = "{Itemizations.Account_Number} = '" & oItemUtil.Account & "'"

                If Trim(oItemUtil.StartDate) <> "" Then
                    .SelectionFormula = "{Itemizations.account_number} = '" & oItemUtil.Account & "'"
                    .SelectionFormula = .SelectionFormula & " And {Itemizations.Trans_Date} >= date("
                    .SelectionFormula = .SelectionFormula & VB6.Format(oItemUtil.StartDate, "yyyy, mm, dd") & ") and {Itemizations.Trans_Date} < date("
                    .SelectionFormula = .SelectionFormula & VB6.Format(DateAdd(Microsoft.VisualBasic.DateInterval.Day, 1, CDate(oItemUtil.EndDate)), "yyyy,mm,dd") & ")"
                End If

                If bPrintPreview Then
                    .WindowShowPrintSetupBtn = True
                    .Destination = Crystal.DestinationConstants.crptToWindow
                Else
                    .Destination = Crystal.DestinationConstants.crptToPrinter
                End If

                .Action = 1
            End With

            lblStatus.Text = "Printing Complete"

                        System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default

            Exit Sub




The program errors out when it hits the .Action = 1 line of code, i'm not sure of another way to get around this error, i'm not very familiar with integrating crystal reports into a vb.net program so if there's a better way to go about showing a crystal report viewer i'd love to hear it. There was nothing helpful on the internet about my specific error.

If this is fixable, however, that would be preferred, I've just spent too much time on this error and have came up with no progress I would love to know the way to get this route working.

Any info, hints, etc would be greatly appreciated, I want to tackle this thing and get it over with. :)

Thanks

Attached File(s)



Is This A Good Question/Topic? 0
  • +

Replies To: Issue with printing - Converted vb6//vb.net program

#2 trevster344  Icon User is online

  • Slick.
  • member icon

Reputation: 124
  • View blog
  • Posts: 873
  • Joined: 16-March 11

Re: Issue with printing - Converted vb6//vb.net program

Posted 07 February 2012 - 08:43 AM

What is the error you are getting? Have you checked to see if action can be set to an integer such as 1?
Was This Post Helpful? 0
  • +
  • -

#3 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 72
  • Joined: 11-March 11

Re: Issue with printing - Converted vb6//vb.net program

Posted 07 February 2012 - 09:01 AM

I attached the error in a word doc but the error is:
System.Runtime.InteropServices.COMException(0x800A5014) Exception from HRESULT: 0x800A5014
at Crystal.CrystalCtrl.set_Action(int16px)
at AxCrystal.AxCrystalReport.set_Action(int16 value)
at ItemizePlus.frmMain.SendFaxNew(Boolean bPrintPreview) in <filepath> line 2336

And yes, action is the property to run the report, it must be set as an integer. 1 will show the report.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1