Solved

Crystal Reports 10 app crash when report is previewd 2nd time

Posted on 2008-10-18
13
2,873 Views
Last Modified: 2013-03-30
I made a vb6 app that shows pre disigned reports in Crystal reports 10, i use a form with Crystal report viewer Activx control. it was working fine until a week ago suddenly it start crashing. when i run my app from vb6 IDE the first time, i can see a report and when i want to see a second report or the same again app just crash and VB IDE crash also sometime telling me that vb6.exe stop working and Send this error .... sometimes it give me a memory error right after i click " Dont send" , it says that the memory could not be "read" and the two location it points are always the same e.g 0x032e2110. any idea what im doing wrong ??
0
Comment
Question by:vickyboyy
[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
  • 6
  • 6
13 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 22750481
Has anything changed on the machine?
O/S fixes?

What code are you using to run the application?

When you close the viewer what code runs to cleanup the VB objects?

mlmcc
0
 

Author Comment

by:vickyboyy
ID: 22753804
thanks for the reply
nothing changed on my machine only if you consider it a change i change my monitor, on my Win xp pro nothing is changed. no new softwares installed, no service pack nothing, after i have this problem i installed sp6 for vb6, it didnt helped. i made an installer for my app and installed on a machine with win xp pro, there i can not open the form for previewing reports. if i open it the app crash immediatly. on a notebook i installed xp home and sp2 for xp. and then i installed my app and all is working i can see the reports without any problem. one thing more what i saw yesterday was that when i add crystal designer to my app in vb6 and run it then it dont give me any error and no crash....but i make an installer with designer added to my app  and try it on a machine with xp pro ..... same crash occurs...here is my code  ( it was working without any problem till a week ago) ... when i dont add crystal designer then i can view one report. second time i want to view the same report or an other report, Crash with or without memory read error but always with " visual basic encounterd bla bla bla ......"

ReportViewRqs is a Global string type

Private Sub Form_Load()


Dim CrReport As CRAXDRT.Report
Dim appcr As CRAXDRT.Application
Dim coninfo As CRAXDRT.ConnectionProperties
Dim CrxTable As CRAXDRT.DatabaseTable
Dim CrTables As CRAXDRT.DatabaseTables
Dim CrTable As CRAXDRT.DatabaseTable

Me.MousePointer = vbHourglass

Set CrReport = New Report
Set appcr = New Application

Dim rpath As String
Dim password As String
password = "MypassworD"



If ReportViewRqst = "Duo" Then




    rpath = App.Path + "\reports\" + "Duo.rpt"
 

    Set CrReport = appcr.OpenReport(rpath)
   
    For Each CrTable In CrReport.Database.Tables
            CrTable.Location = App.Path + "\Database\FIGHT.mdb"
        Next
   
   

    For Each CrxTable In CrReport.Database.Tables
            CrxTable.SetSessionInfo "", Chr(10) & password
        Next CrxTable
   
 CrReport.RecordSelectionFormula = "{Fightsystem.Fight_ID}=1"
   
   
   
  ElseIf ReportViewRqst = "Fighting" Then




    rpath = App.Path + "\reports\" + "Fighting.rpt"
 

    Set CrReport = appcr.OpenReport(rpath)
   
    For Each CrTable In CrReport.Database.Tables
            CrTable.Location = App.Path + "\Database\FIGHT.mdb"
        Next
   
   

    For Each CrxTable In CrReport.Database.Tables
            CrxTable.SetSessionInfo "", Chr(10) & password
        Next CrxTable
   
 CrReport.RecordSelectionFormula = "{Fightlist.Fightsystemid} = 2 and {Fightlist.Fightid} = 1"
   

 
 
End If
Cr.ReportSource = CrReport




Cr.ViewReport
Me.MousePointer = vbNormal
Set CrReport = Nothing
Set appcr = Nothing
Set coninfo = Nothing
Set CrxTable = Nothing
   

End Sub

hope to see your comment soon while i have to finish this in this week ..Thanks again

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22754594
You might change the order of the Set to nothing

Set CrxTable = Nothing
Set coninfo = Nothing
Set CrReport = Nothing
Set appcr = Nothing
   
In that way you are working out from the inards of the report.  When you set the report object to nothing you may alsio be deleting the memory pointed to by the connection info and the tables.

mlmcc
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:vickyboyy
ID: 22754627
i was waiting for your answer all the time...
i tried it ... same as before .. crash

is there a simple way to display reports. am i using anything which i really dont need and may be that is the caus of my problem. i dont know much about crystal reports 10.
waiting.......
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 130 total points
ID: 22754779
Here is the basic code we used with CR8.  It is similar to yours.  We had our own development network so we set it up to look exactly like the prod with our database server named the same and the shares mapped the same.  In that way we didn't haev to change the tables, the report didn't know anything had changed.  We also used Windows Authentication for database access and the Everyone group had read permissiions as required.

The only thing I see different is we used the viewer.  If your CR object is the viewer then that looks to be the same

mlmcc
Option Explicit
    Private crApp As CRAXDRT.Application
    Private crRpt As CRAXDRT.Report
 
Public Sub crPreview_Report(txtReportName As String, _
                                            txtSelectClause As String)
 
On Error GoTo errHandler
 
'
'   Check if report is already in use
'
    If IsObject(crRpt) Then
       Set crRpt = Nothing
    End If
 
'
'   Open report
'
    Set crApp = New CRAXDRT.Application
 
    Set crRpt = crApp.OpenReport(txtReportName, 1)
    crRpt.RecordSelectionFormula = txtSelectClause
 
'
'   Set flags for CRViewer
'
    crRpt.MorePrintEngineErrorMessages = False
    crRpt.EnableParameterPrompting = False
    crRpt.DiscardSavedData
 
 
'
' Set the viewer's report source to the Report object
'
    Me.rptCRViewer.ReportSource = crRpt
    Me.rptCRViewer.ViewReport
    Me.Show
 
    Exit Sub
 
End

Open in new window

0
 

Author Comment

by:vickyboyy
ID: 22763955
hi
i try to do it your way and without any selection formula, just to show the report as it was saved in crystal report 10. it also didnt worked. can you tell me that is there any diffrence between CR 10 and CR XI and which one is supported on Vista. i tried to install my app on vista and it gaved me a dependency error for crviewer.dll ( installed and run as admin). can i use CRXI with vb6. will it bring something good. i mean that can i get rid of this error if i use CR XI

thanks for your help.
Regards
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22764134
CR XI with a service pack is supported on Vista.

If you have CR XI R1 (11.0.xx) then it is SP4
If you have CR XI R2 (11.5.xx) then it is SP2

I don't think CR10 is supported on Vista.

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22764138
You can use CR XI with VB6.  That is the last version that will support VB6.

mlmcc
0
 

Author Comment

by:vickyboyy
ID: 22772581
the last thing i want to know. can you give me a link to a good tutorial for CR XI to use with vb6. or any website where i can learn more about CR XI ....
Thank you for your time and help.
0
 

Author Comment

by:vickyboyy
ID: 22772584
and To create install package for vista.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22773503
Unfortunately I can't give you one for use with VB6.

The best I can do is refer you to the references I use which are the complete reference series.

The Complete Reference Crystak Reports nn by Peck

http://www.crystalbook.com/crtcr/program/book/home.asp

mlmcc
0
 

Author Comment

by:vickyboyy
ID: 22781770
Hey
I found out what i was doing wrong. i want to share that with you. i found that in CR 10 examples and then i examin your code and there it was also. so what was going wrong. in my code ...


Dim CrReport As CRAXDRT.Report
Dim appcr As CRAXDRT.Application
........
.......

here is the PROBLEM  im setting CrReport as new report butt i have to set it as New CRAXDRT.Report
and the same for .Application ....
and what i was doing wrong ...

Set CrReport = New Report
Set appcr = New Application

i tried it and it workd 100%
Thanks that you took interest in my problem. i will accept your example as solution. afterall you are the only one here who is trying to help me and you did.
CHEERS
0
 

Expert Comment

by:maxcellx
ID: 39034935
Thank you ... I tried all the ways to resolve this problem but it's never help
and then I simply define the report  object generaly and  Realy it's working with me very good
thank you guys
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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