We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Crystal report v.9

fmax01
fmax01 asked
on
Medium Priority
1,210 Views
Last Modified: 2013-12-25
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
Comment
Watch Question

CERTIFIED EXPERT

Commented:
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


Author

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?

???????
CERTIFIED EXPERT

Commented:
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

Author

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?

CERTIFIED EXPERT

Commented:
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

Author

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?????????
CERTIFIED EXPERT

Commented:
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

Author

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!!!!!!!!!!!!!!!!!!!!!!!
CERTIFIED EXPERT

Commented:
Post the code please. I would like to verify. Thanks

dragontooth

Author

Commented:
ok, tell me the e-mail addres, thanks
CERTIFIED EXPERT

Commented:
sometimes an expert has their e-mail in thier profile for short periods of time :)

dragontooth

CERTIFIED EXPERT

Commented:
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

Author

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

CERTIFIED EXPERT

Commented:
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

Author

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

Author

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
CERTIFIED EXPERT

Commented:
I will look. Sorry so late getting back was in a meeting.

dragontooth

CERTIFIED EXPERT

Commented:
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

Author

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......... .(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((
CERTIFIED EXPERT

Commented:
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

Author

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.

Author

Commented:
I tried to display more information on crystal report and i see that the crviewer9.dll is not present in list "LOADED MODULES"
CERTIFIED EXPERT

Commented:
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

Author

Commented:
nothing!

i pick the dll from the directory but no changes.... same error
CERTIFIED EXPERT

Commented:
This may sound silly but is the dll listed and checked?

dragontooth

Author

Commented:
yes the component "Crystal Reports Viewer Control 9" is checked......
CERTIFIED EXPERT

Commented:
Ok have you picked the control that looks like a piece of paper with a magnifying glass and placed it on the form?

dragontooth

Author

Commented:
sorry but i dont understud !!!!
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
finally....

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


Thanks.......
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.