Solved

Crystal report v.9

Posted on 2004-04-02
30
1,145 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
  • 15
  • 15
30 Comments
 
LVL 14

Expert Comment

by:Tommy Kinard
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:fmax01
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Post the code please. I would like to verify. Thanks

dragontooth
0
 

Author Comment

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

Expert Comment

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

dragontooth

0
 
LVL 14

Expert Comment

by:Tommy Kinard
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:fmax01
Comment Utility
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
Comment Utility
I will look. Sorry so late getting back was in a meeting.

dragontooth

0
 
LVL 14

Expert Comment

by:Tommy Kinard
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
nothing!

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

Expert Comment

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

dragontooth

0
 

Author Comment

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

Expert Comment

by:Tommy Kinard
Comment Utility
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
Comment Utility
sorry but i dont understud !!!!
0
 
LVL 14

Accepted Solution

by:
Tommy Kinard earned 500 total points
Comment Utility
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
Comment Utility
finally....

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


Thanks.......
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now