Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1172
  • Last Modified:

Crystal report v.9

Hello,

i need some help about Crystal Report....

I have build the report on Crystal and that run ok!

Now i will insert this report into the VB application.

I tried but the following message appears:

run-time error "424"
object required


this is the code inserted into the application:

Dim Report As CRAXDRT.Report
Dim crxApp As CRAXDRT.Application

Set crxApp = New CRAXDRT.Application
Set Report = crxApp.OpenReport("c:testrpt.rpt", 1)
 
'after we have a valid instance of the report object, assign it
CRViewer91.ReportSource = Report
CRViewer91.ViewReport

Thanks in advance for any help
0
fmax01
Asked:
fmax01
  • 15
  • 15
1 Solution
 
Tommy KinardCommented:
Have you included the Crystal Report Viewer Control 9 and Crystal Reports 9 Activex Designer Runtime Library in your project?
Does c:testrpt.rpt exist? (c:\testrpt.rpt)
Do you have a form setup just for displaying the report?

dragontooth


0
 
fmax01Author Commented:
Have you included the Crystal Report Viewer Control 9 and Crystal Reports 9 Activex Designer Runtime Library in your project?

YES

Does c:testrpt.rpt exist? (c:\testrpt.rpt)

YES

Do you have a form setup just for displaying the report?

???????
0
 
Tommy KinardCommented:
In a new form add the CRViewer control to the form. It should cover the whole form. Paste the code below into it. Call this form frmCrystal.frm


Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report


Private Sub Form_Load()
    Set Report = Appl.OpenReport(ReportFile)  '<-- ReportFile is  my global variable that would hold "c:\testrpt.rpt"
    CRViewer91.ReportSource = Report
    CRViewer91.ViewReport
End Sub
Private Sub Form_Resize()
    With CRViewer91
        .Top = 0
        .Left = 0
        .Width = Me.ScaleWidth
        .Height = Me.ScaleHeight
    End With
End Sub

on another form have a command button with this code
Private Sub Command_Click()
    ReportFile = "c:\testrpt.rpt"
    frmCrystal.Show
End Sub


dragontooth

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.

 
fmax01Author Commented:
Well, i tried to put the code into the form but the value of ReportFile is NULL into the following instruction:

Set Report = Appl.OpenReport(ReportFile)  '<-- ReportFile is  my global variable that would hold "c:\testrpt.rpt"

Why?

0
 
Tommy KinardCommented:
In a module
Public ReportFile as String

if you have a command button setup as:
Private Sub Command_Click()
    ReportFile = "c:\testrpt.rpt"
    frmCrystal.Show
End Sub

then the form should show the "c:\testrpt.rpt"

dragontooth

0
 
fmax01Author Commented:
nothing.....

the error is alwais the same.....

during the execution of the following instruction:

  CRViewer91.ReportSource = Report

the code returned is:

   run-time error "424"
   object required

why?????????
0
 
Tommy KinardCommented:
The only reason I can think of right now is the "c:\test.rpt" does not exist either at all or it is not located in c:\

dragontooth

0
 
fmax01Author Commented:
thanks  but the file testrpt.rpt exist on c:

i tried to point at one false file and the message is:

File not found.......

i'm very deprived of hope!!!!!!!!!!!!!!!!!!!!!!!
0
 
Tommy KinardCommented:
Post the code please. I would like to verify. Thanks

dragontooth
0
 
fmax01Author Commented:
ok, tell me the e-mail addres, thanks
0
 
Tommy KinardCommented:
sometimes an expert has their e-mail in thier profile for short periods of time :)

dragontooth

0
 
Tommy KinardCommented:
fmax01,
I could not get the project to run it may be because of language settings.

I changed frmCrystl.frm to the below.

Dim Appl As New CRAXDRT.Application  '<-moved these to here
Dim Report As New CRAXDRT.Report  '<-moved these to here

Private Sub Form_Load()
    Set Report = Appl.OpenReport(ReportFile)  '<-- ReportFile is  my global variable that would hold "c:\testrpt.rpt"
    CRViewer91.ReportSource = Report
    CRViewer91.ViewReport
End Sub
Private Sub Form_Resize()
    With CRViewer91
        .Top = 0
        .Left = 0
        .Width = Me.ScaleWidth
        .Height = Me.ScaleHeight
    End With
End Sub

'<********************************************
'< I also added the Crystal Report Viewer under
'< Components then added the control to the form
'<********************************************

I changed module1.bas (just the 2nd line)

Public fMainForm As frmMain
Public ReportFile As String  '<-- moved to here

dragontooth

0
 
fmax01Author Commented:
well,

the pgcd.vbp inserted into the zip file doesnt work ( several errors never seen before)!!!!!!!!!!!!!!!!!!!!!

I tried to replicate the changes into the frmCrystal.frm, Module1.bas and pgcd.vbp but the error is alwais the same:

 run-time error "424"
   object required

0
 
Tommy KinardCommented:
look for

C:\Program Files\Common Files\Crystal Decisions\2.0\crystalreportviewers\ActiveXViewer\crviewer9.dll

also I have upgraded to sp6 for Visual Studio that may be the reason do you need the original back?

Do you have the service pack from crystal?
Are you using the Crystal Reports 9.0 Developer?

dragontooth

0
 
fmax01Author Commented:
hi again,

I don't have any   \2.0\crystalreportviewers\ActiveXViewer\crviewer9.dll

no i dont have upgraded to sp6
no i dont have service pack from crystal
yes i use Crystal report 9.0
0
 
fmax01Author Commented:
hi,

i have upgraded to sp6 and now the pgcd.vbp on zip file work, but the error is alwais the same.

Which service pack from crystal? I will try to upgrade also Crystal
0
 
Tommy KinardCommented:
I will look. Sorry so late getting back was in a meeting.

dragontooth

0
 
Tommy KinardCommented:
Here is the service pack

Don't forget to read the pdf files that are included also pick the correct language

http://support.businessobjects.com/fix/hot/si75/

dragontooth

0
 
fmax01Author Commented:
nothing, nothing, nothing....................

I have upgraded to sp6 for VB6, i have installed the sp for crystal report but the error is ALWAIS the same......... .(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
0
 
Tommy KinardCommented:
Do you have the developer version?
can you find crviewer9.dll anywhere?

I did display the report in CR and also displayed it with you app.

dragontooth

0
 
fmax01Author Commented:
I have Crystal Report 9 professional full version: 9.2.2.634

i found the crviewer9.dll into the following directory:

c:\program files\shared files\crystal decisions\2.0\crystalreportviewers\ActiveXViewer

also I did display the report in CR but no in my appl.
0
 
fmax01Author Commented:
I tried to display more information on crystal report and i see that the crviewer9.dll is not present in list "LOADED MODULES"
0
 
Tommy KinardCommented:
We may be almost there :) I know it is frustrating but we'll get there from here.

Pick Project in the VBIDE
Pick components
scroll down till you see  Crystal Reports Viewer Control 9

It should be complaining about it, pick browse, got to the directory where the viewer is select it and pick ok. This should fix the problem, if it does not double check for the report in the c:\.

dragontooth

0
 
fmax01Author Commented:
nothing!

i pick the dll from the directory but no changes.... same error
0
 
Tommy KinardCommented:
This may sound silly but is the dll listed and checked?

dragontooth

0
 
fmax01Author Commented:
yes the component "Crystal Reports Viewer Control 9" is checked......
0
 
Tommy KinardCommented:
Ok have you picked the control that looks like a piece of paper with a magnifying glass and placed it on the form?

dragontooth

0
 
fmax01Author Commented:
sorry but i dont understud !!!!
0
 
Tommy KinardCommented:
This control is like a txt box or combo box to use it you have to place it on the form. If the Crystal Reports Viewer Control 9 is checked there should be a new icon on the left hand side under the general tab. It should look like a paper with writing on it and a magnifing glass. pick this control and place it on the form. This control's default name is CRViewer91.

dragontooth

0
 
fmax01Author Commented:
finally....

run!!!!!!!!!!!!!!!!!!!!!!


Thanks.......
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 15
  • 15
Tackle projects and never again get stuck behind a technical roadblock.
Join Now