Crystal Report Question - URGENT


I've been working with VB5 and the shipped version of Crystal Reports 4.6
viewing reports using CrystalReport1.Action = 1.

I've now moved onto VB6 and Crystal Report Version 8 Pro.

Using the CrystalReport component from 4.6 brings up a run-time error.

Do I need to use the CRViewer component and if so, what coding is required to locate the report and view it in the VB application form?.

Thanks in advance.

Rgds Tam97
Who is Participating?
VoodoomanConnect With a Mentor Commented:
OK use the CrystalReport.ocx not the viewer its very easy.

Add the Crystal.OCX to your components (Ver 8.0) - call it myreport

Set the properties of the compontent which you must specify

Destination =0-crpt to window

DataSource - leave Empty


ReportFileName - the name and path of your report that you designed.

Now stick a button on the form

Sub Command1_Click()


End Sub

The Report will open

Good Luck


P.s. The Report Designer is part of CRVer 8.0 you can add it from Components - Designers.

Trust me the above is the best way to run a report - forget the Viewer and the designer - they are underdeveloped and troublsome.

Whats the error you are getting?

I open 4.6 Pro Reports with Ver 7.0 no problem.

I dont use the viewer its poo!

I use the crviewer... it gives me maximum flexibility (unless you want to go to APIs... that's difficult).

You may want to open your 4.6 report in Crystal itself and save it as a ver. 8 report then try it.

Another thing maybe that you say you are using the 4.6 component... Ver.8 has a crystal report OCX that you should upgrade to.
Never miss a deadline with

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

tam97Author Commented:
g jones

I also want to use the crviewer as it's one of the new components that is now available since I upgraded.

Could you advise the procedure and coding you use to display an existing report from the VB application.

Regarding Voodooman's comment, maybe I gave the wrong impression, I can also open 4.6 reports with ver.8, I can also open 4.6 from the VB application using the 4.6 component.

What I need now to do, is open a ver.8 report from the VB application using whatever component is required to do the job.

Any help apprieciated.

Rgds Tam97
I have same problems in Crystal Reports 4.6 presented in VB, when long data exceeds the space provided by design's Report.   By default data space is sufficient, but we can change.   Try to probe with longer space.

You can find sugestion in: 

For the latest Report Designer Component updates, developer tips and other related information, check out
our Visual Basic developer web page at .

tam97Author Commented:
Hi amarti

Thanks for comment, I've already  tried the knowledge base , with regards to the Report Designer Component, the people that bought me this product just paid out £250 for it, therfore this basic component should be included.

What I really need is the procedure and coding to view an existing report in the VB application using what is available with the product as is, nothing more complicated than that, surely this can be done with a product of this class.

Rgds Tam97
I use these Sub:

  Dest$ - IMP printer, PAN monitor
  Rep$ - Name of report file ("MyReport.rpt")

Sub Reporte(Dest$, Rep$)
  On Error GoTo ErrRep:
  Dim Ko As Object: Set Ko = KRep!CryRep 'Crystal Control
  Ko.ReportFileName = Rep$: Ko.SelectionFormula = Seleccion$
  Select Case UCase$(Dest$)
    Case "PAN"  'Monitor
     KRep.WindowState = 2: Ko.WindowParentHandle = KRep.hWnd  'sets the WindowParentHandle to the handle of Form. This specifies that the print window is to be a child of Form »
     Ko.Action = 1: KRep!KRep1.ZOrder 0: KRep!KRep2.ZOrder 0: KRep!KRep3.ZOrder 0
     'when finish to view
     KRep.Cls: Ko.Action = 0
    Case "IMP"  'Printer
      Ko.Destination = 1
      z$ = InputBox("¿Copies of Reporte?", "REPORT", 1, 100, 100)
      re = Val(z$): If re < 1 Or re > 99 Then re = 1
      Ko.CopiesToPrinter = re: KRep.MousePointer = 11
      Ko.Action = 1
      KRep.MousePointer = 0: CnOf KRep!aviso
  End Select
  Set Ko = Nothing 'for free memory
  Exit Sub

  res = MsgBox(Err.Description, 21)
  If res = 2 Then Exit Sub Else Resume

End Sub
I have posted a sample VB app that has an example of using the crviewer on my website:
follow the Visual Basic link , the file link is at the bottom of the page :)

Good Luck!
I have posted a sample VB app that has an example of using the crviewer on my website:
follow the Visual Basic link , the file link is at the bottom of the page :)

Good Luck!
tam97Author Commented:
Hi gordon

Have been to your site and downloaded code.

Now I know how much of a beginner I really am, could I ask one more favour of you, in order to focus into exactly what I need could you show me the "cut-down" code for the following scenario.

I have an Access database residing at C:\Staffing, db name is Adobe.mdb, the report I wish to view from the application is called 'Rostering.rpt'(which is already created).

I have a form which runs a query, empties the data table then inserts the new values into the table, the report is linked to this table. I have a button on the form that will 'hopefully' display the report in a new form, it's the coding of this button
I really need and if possible in it's simpliest form.

Sorry if I'm being a pain, hope you can assist.

Best Rgds Tam97
All Courses

From novice to tech pro — start learning today.