Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Crystal Report Problem, Help!!!


Reply
 
Thread Tools Display Modes
  #1  
Old 03-23-2004, 12:26 PM
Hope Hope is offline
Freshman
 
Join Date: Mar 2003
Posts: 28
Default Crystal Report Problem, Help!!!


Hi, all

I'm using the embedded .dsr(crystal report 8.5) within VB6,

the following code

Private Sub cmdPrint_Click()
Dim rpt As New CrystalReport1
Set rpt= Nothing

Dim crxTable1 As CRAXDRT.DatabaseTable
Dim crxTable2 As CRAXDRT.DatabaseTable
Dim crxTable3 As CRAXDRT.DatabaseTable

Set crxTable1 = rpt.Database.Tables.Item(1)
crxTable1.SetDataSource rsCoInfo, 3

Set crxTable2 = rpt.Database.Tables.Item(2)
crxTable2.SetDataSource rsCkHead, 3

Set crxTable3 = rpt.Database.Tables.Item(3)
crxTable3.SetDataSource rsDetail, 3

CRViewer1.ReportSource = rpt
CRViewer1.ViewReport
Do While CRViewer1.IsBusy
DoEvents
Loop

rpt.SelectPrinter g_sPrtDriver, g_sPrtName, g_sPrtPort
rpt.PrintOut False

rsCoInfo.Close
rsCkhead.Close
rsDetail.Close
Set rsCoInfo = Nothing
Set rsCkhead = Nothing
Set rsDetail = Nothing
Set rpt = Nothing

end sub

seems work fine, the report can be printed,
and also I can see the report in the Crviewer1 ( 175 pages).
the problem is: when i click next page, the next page will be shown,
then i continue to click next page, sometime on about 20 pages,
sometime about 50, or 80 pages, the error happen:
(the error also happen when i try to export it to (pdf))

Visual Basic has encountered a problem and needs to close,
we are sorry for the inconvenience.

I click "To see what data this error report contains ", have Info:

AppName: vb6.exe Appver: 6.0.88.62 ModName: CRAXDRT.DLL
modver: 5.1.26600.0 offset 000f0eda

only one time had following info:
AppName: vb6.exe Appver: 6.0.88.62 ModName: ntdll.DLL
modver: 5.1.26600.0 offset 00003209

In fact, my program only need print out, no preview needed,
but I don't want to print it each test time, so i use CRviewer,then
I got this error.
so the 1st question is:
if i don't use CRviewer, only print it out, will this code have some
potential problem when I distribute my app in client Machine?

The OS of my develop machine is Window XP
we use visual basic 4.0 standard edition, then use Visual Basic 6.0
professional Edition upgrade version to upgrade it. use service pack 4.
use crystal reports developer edition version 8.5
my app using following references(same order),

Visual Basic For Applications
viausl Basic runtime objects and procedures
visual basic objects and procedurs
ole automation
microsoft internet controls
microsoft activeX data objects 2.7 library
microsoft data formating object library 6.0(sp4)
crystal report viewer control
crystal reports 8.5 ActiveX Designer Design and runtime library
crystal reports 8.5 ActiveX Designer Run time library
crystal report viewer control
microsoft outlook outlook 10.0 object library
microsoft data bind collection vb6.0 (sp4)
all crystal reference were added automaticlly by system
when i add crystal report 8.5
I use 3 .ttx file for my report's database fields,
ckhead.vendNo visual link to ckdetail.vendNo
coInfo not link to any other (alonly)
my report has 9 sections:
Report Header: ---> suppress
page header
page header a --- company info and Ckhead
page header b ----company info
Group header ---no fields
Details ---rsDetail
Group Footer --> New Page After, Reset Pge Number After, Keep together
page footer ---has some txtbox
Report Footers ---> suppress

In page header a I have following code:

Private Sub Section6_Format(ByVal pFormattingInfo As Object)
If fldCurrPage.Value = 1 Then (fldCurrPage is pageNumber)
fldCkNum.Font = "IDAutomationSMICR"
fldCkNum.Font.Size = 12
End If
End Sub

when i kept getting this error, I try to restart a new report template (.dsr),
and the new rpt did work ok, i can click from frist page to last page,(i'm not
sure if there's future problem, i only test two times)
so i guess maybe the old rpt or system corrupted somewhere, so i
reinstall the VB6 and crystal report 8.5, when i test again,
that new worked report got same error,
I study crystal report by myself, I don't know if there's design issue in
my program, or this report has 3 data file(.ttx) then cause this error? or
this report has 175 pages then out of memory?
i also have tried using subreport, I inserted a subreport in detail using following code
and i got same error

Dim rpt As New CrystalReport1
Set rpt= Nothing
Dim rptSub As CRAXDRT.Report
rpt.Database.SetDataSource rsCkhead
Set rptSub = rpt.Subreport1.OpenSubreport
rptSub.Database.SetDataSource rsDetail
CRViewer1.ReportSource = rpt
CRViewer1.ViewReport
Do While CRViewer1.IsBusy
DoEvents
Loop
rpt.SelectPrinter g_sPrtDriver, g_sPrtName, g_sPrtPort
rpt.PrintOut True


I have several other .dsr reports, they have only one .ttx bound to them, like
Dim rpt As New CrystalReport1
Set rpt= Nothing
rpt.Database.SetDataSource rs
CRViewer1.ReportSource = rpt
CRViewer1.ViewReport
They work ok, (not sure has poential error, they only have 50 pages at most)


there's also another problem, when my app include crystal report .dsr, ererytime i save or run the app, i got so many .tmp in App dir and c:/ dir,
how to get rid of them, if i install my app in client machine, is there any problem with these .tmpI have struggled with crystal report for long time, i'm not sure if choosing crystal is right decision, (someone suggest me using
Visual Report, which one is better?)
I wrote so many just want to make my prolems clear,
i want repeat my queations:
can i ignore this error and there's no poential danger?
is bad program design or too mang pages or multiple datasource
causing this error?
or system .dll cause conflict?
how to deal with .tmp file?
i saw some code like
Dim rptSub As CRAXDDRT.Report
which one should use, CRAXDRT or CRAXDDRT?

in this code "crxTable1.SetDataSource rsCoInfo, 3"
what does 3 represent?


so if somebody can help, i'll really appreciate.


Thanks

Hope
Reply With Quote
  #2  
Old 03-23-2004, 04:52 PM
MKoslof's Avatar
MKoslof MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

So these errors occur randomly on certain pages of the report? That is quite strange. An initialization error would occur when the report first starts to load, which leads me to believe it is a connection error, or the CRViewer dll is corrupt? This occurs on your development machine as well? If you create a small report (just restrict your recordset to 3 or 4 pages) does the error still occur?

You also shouldn't have so many tmp files. These tmp files are in the App.path directory, where the .dsr files and the application reside? It appears you having some configuration issues. I would do a fresh install of VB 6...make sure any instances of VB4 are gone. And do a fresh install of Crystal and see if this helps
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
  #3  
Old 03-24-2004, 10:24 AM
Hope Hope is offline
Freshman
 
Join Date: Mar 2003
Posts: 28
Default

Thanks, Mr. Mkoslof

Yes, this occurs on my development machine, I havn't created .exe to distribute.
all my .dsr .frm application reside in App.path dir.

I tested my app this morning, I created a smll report which limited 5 pages, tested serveral time,
no error occured, and i could exported to .pdf file, but the strange thing is, when i check the
saved pdf files, some pdf file have 0 kb size, i opend it, and i can find the report there, some pdf file
has like 21 kb size, so why this happen?
i ran my app and produced 175 pages, same error happened.

sometime when I close project, a window pop up with prompt: save chage to the following files?
no matter click Yes or No, the error happened with info:
Visual Basic has encountered a problem and needs to close,
we are sorry for the inconvenience.
AppName: vb6.exe Appver: 6.0.88.62 ModName: vb6.exe
modver: 6.0.88.62 offset 000cedce

when i save project, I found 14 .tmp file were created in App.path dir, 14 .tmp files created in c:\ dir.
when i run project, also lot of .tmp files created in both dirs

when I create a new vb project1, add crystal 8.5 report as a blank report, using expert add a form
containg the viewer, and save project1, no .tmp created; close project1, no .tmp created.
then open project1, and a text1 to CrystalReport1 and save project, one .tmp created in c:\dir and
one .tmp created in App.path dir.

the good news is: I mentioned in last post, i had created a new report to test and it did work,
I bakup it with project, and this morning i run that bakuped project, it worked ok, the 175 pages
could be printed out, and shown in CRviewer, and i was able to click from first page to last page,
and exported to .pdf file with 436 kb size, i tested 3 times, everytime it worked ok. but i'm
not sure if there's future problem

so for me now, I still don't know where's problem, I read some posts, I plan to install
MDAC_TYP 2.8 version and SP5, is there any potenial conflict with that?
since I'm not confident with crystal report, can Mr. Mkoslof tell me:
the vb code deal with crystal report ( I posted in last thread) is OK?
when use Dim rptSub As CRAXDDRT.Report
which one should use, CRAXDRT or CRAXDDRT?

in this code "crxTable1.SetDataSource rsCoInfo, 3"
what does 3 represent?
and also, if you can help me to get rid of the .tmp files, I really appreciate.
Thanks
Hope
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB6 and Crystal Report 8.5 RTF Format Problem Mohit Database and Reporting 3 06-09-2011 07:11 AM
crystal report problem Hope Database and Reporting 11 01-23-2004 08:59 AM
Crystal Report 9 and VB Problem anotherDove Database and Reporting 7 10-24-2003 10:37 AM
Crystal Reports 9.0 on VB .NET Report Won't Print Correctly ccherry Database and Reporting 1 09-08-2003 11:30 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->