Solved

Crystal report v.9

Posted on 2004-04-02
30
1,163 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
0
Comment
Question by:fmax01
[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
  • 15
  • 15
30 Comments
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10742006
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
 

Author Comment

by:fmax01
ID: 10742094
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
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10742205
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:fmax01
ID: 10743949
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
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10744064
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
 

Author Comment

by:fmax01
ID: 10756204
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
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10757612
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
 

Author Comment

by:fmax01
ID: 10757949
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
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10758003
Post the code please. I would like to verify. Thanks

dragontooth
0
 

Author Comment

by:fmax01
ID: 10758137
ok, tell me the e-mail addres, thanks
0
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10758204
sometimes an expert has their e-mail in thier profile for short periods of time :)

dragontooth

0
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10758610
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
 

Author Comment

by:fmax01
ID: 10759788
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
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10759986
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
 

Author Comment

by:fmax01
ID: 10760352
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
 

Author Comment

by:fmax01
ID: 10760460
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
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10760496
I will look. Sorry so late getting back was in a meeting.

dragontooth

0
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10760698
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
 

Author Comment

by:fmax01
ID: 10760859
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
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10760902
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
 

Author Comment

by:fmax01
ID: 10761053
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
 

Author Comment

by:fmax01
ID: 10761119
I tried to display more information on crystal report and i see that the crviewer9.dll is not present in list "LOADED MODULES"
0
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10761137
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
 

Author Comment

by:fmax01
ID: 10761297
nothing!

i pick the dll from the directory but no changes.... same error
0
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10761422
This may sound silly but is the dll listed and checked?

dragontooth

0
 

Author Comment

by:fmax01
ID: 10761477
yes the component "Crystal Reports Viewer Control 9" is checked......
0
 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 10765467
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
 

Author Comment

by:fmax01
ID: 10766509
sorry but i dont understud !!!!
0
 
LVL 14

Accepted Solution

by:
Tommy Kinard earned 500 total points
ID: 10766572
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
 

Author Comment

by:fmax01
ID: 10767037
finally....

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


Thanks.......
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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