?
Solved

Crystal report with OLE runs in VB6 on win 2000 but not xp.

Posted on 2008-11-13
15
Medium Priority
?
555 Views
Last Modified: 2012-05-05
I am maintaining an application written in vb6 that uses a crystal report imported into report designer.  The report runs fine on a win 2000 machine, but the print job hangs up
on xp.

I have a number of applications in VB6 that use a crystal report and they all run fine on XP & except this one.

The difference in this report is that vb sends one report to the printer at a time with several parameters, as it steps through a record set.  It is a one page report.  Theres usually 200+ records, generating 200+ single page reports.  Event code within the report embeds a different bitmap into an ole control depending on the bitmap path/filename parameter.


The report runs without a glitch on win 2000, regardless of how many are sent to the printer at a time, up to 500 that Ive seen  XP will usually do fine if there are only few records.  Then it hangs up iin the middle of printing and the app has to be killed.  If I remove the bitmap, it will run on XP.

'-----------------------------------
Crystal Report event code:
'-----------------------------------
Private Sub Section21_Format(ByVal pFormattingInfo As Object)
Dim crxPicture As CRAXDDT.OLEObject
Set crxPicture = Me.Sections("section10").ReportObjects.Item("Image1")
Set crxPicture.FormattedPicture = LoadPicture(Path\ImageName.bmp)
Me.Image1.SetOleLocation Path\ImageName.bmp
Set Image1.FormattedPicture = LoadPicture(Path\ImageName.bmp)
End sub
'-----------------------------------
VB6 - print report
'-----------------------------------
Function PrintReport(iInCount As Integer, sException As String, sCust, sGroupId As String) As Boolean
Dim Report As crpPTTPickTicket
 
On Error GoTo errorHandler
    
    PrintReport = True
    If ShowFileAccessInfo(FilePathandName) Then
        
        Set Report = New crpPTTPickTicket
        Report.ParameterFields(1).AddCurrentValue sCONumber 'global var
        Report.ParameterFields(2).AddCurrentValue sException
        Report.ParameterFields(3).AddCurrentValue sCust
        Report.ParameterFields(4).AddCurrentValue sPrintPO 'global var
        Report.ParameterFields(5).AddCurrentValue sGroupId
        Report.PrintOut False, 1
        Set Report = Nothing
    Else
        
        PrintReport = False
    End If
    Exit Function
    
errorHandler:
    
    PrintReport = False
    
End Function

Open in new window

0
Comment
Question by:Delta7428
  • 8
  • 7
15 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 22953703
What version of Crystal.

CR9 is the first versiion that was tested on XP.  Early versions aren't supported on XP and have mixed results.

mlmcc
0
 

Author Comment

by:Delta7428
ID: 22953788
It's in the crystal report designer in VB6.  It may have been created in crystal 8 and imported into designer.  

I have a number of other applications with crystal reports 8 and XP that all run with no problem ... as well does this one, if I remove the OLE object from the report.
0
 

Author Comment

by:Delta7428
ID: 22953873
ok ... so it's not the OLE.  I just did a second test with it removed and it locked up at about the 40th report.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
LVL 101

Expert Comment

by:mlmcc
ID: 22954959
Sounds like a resource issue.

Not sure why the issue doesn't appear in Win2K unless it is a CR8 and XP problem.

As I stated above results with CR8 and XP have been mixed.  Mainly a report either works or it doesn't and even within an organization it will run for some but not others.

mlmcc
0
 

Author Comment

by:Delta7428
ID: 22978685
But it does work, consistently on XP, and consistently on different xp machines.

It only hangs up if you're printing more than a few reports (it varies as to how many will run before it hangs up):

Here is how the report is called.

For icount = 1 to adoOrders.RecordCount
    PrintReport(icount, sException, sBoldCustName, sGroupId)
    adoOrder.movenext
next

There may be anywhere from 20 to 500 records in adoOrders, each generating a different report.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22978978
You might put a delay in the loop.

Is it failing on the last one?

mlmcc
0
 

Author Comment

by:Delta7428
ID: 22979029
I already tried adding a timer delay ... didn't help.  Thinking back, I believe it did go take longer to hang up.  But it's been so inconsistent as to how many it will print, sometimes 1 or 2, usually 20 or more.   Once, it did the whole print job (120).

Other than that one time, it always fails way before the last.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22979951
Thought maybe you were trying to print one too many.

How long a delay have you tried?

Have you considered using a third-party tool to "burst" the full report rather than running it once for each record?

mlmcc

0
 

Author Comment

by:Delta7428
ID: 22981373
I believe the delay was for 3 or 4 seconds.  I thought at first it was going to work, because it printed more than usual.  I thought I might go back and try extending the delay.  I'm ready to bill microsoft for the printing costs though ...

What type of third party tool?    The bitmaps are loaded from the server into the ole object as the report prints according to the order# that is printing.  I have considered preloading them into an ole field and loading it from the field on the report instead.   I still have other parameters to consider that are logically derived within the code.
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 22981592
Since you are loading bitmaps you might have to put them into a database or upgrade to CRXI which can handle using a filename as the source.

I hadn't looked thoroughly at the code so it may not be possible to use a tool because of the need to load the bitmaps.

I suspect you are running into a resource issue.  Either lack of memory of contention for files.

You might try a delay of 10 seconds.

Can you reduce your number of records in a run to say 50 or 100 at a time?

mlmcc
0
 

Author Comment

by:Delta7428
ID: 22981642
I will try tomorrow increasing the delay and reducing the number of records to print in increments of say 1-50, then 50-100, etc.   I have considered that before, but that's not ideal because it would require user interaction.  They are used to being able to kick off the print job and letting it run in win 2000.  I keep thinking there must be something in the hardware settings in xp that could be tweaked... or something.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22981871
I agree it is not ideal but since you are using older technology (VB6 and CR8) it may be the only solution.

mlmcc
0
 

Author Comment

by:Delta7428
ID: 23012430
I finally got a chance to test increasing the delay on the timer.  I haven't had access to a printer that would do the job as they've been tied up printing the surge in holiday orders  ... job security!

It seems to be working.  I increased the delay to 10.5 seconds.  It's running as I'm typing this and has printed so far 130 of 140 jobs that I sent.  It's taking forever.  I'm going to try cutting that down to about 5.5 seconds and see how it goes.

Thanks mlmcc
0
 

Author Comment

by:Delta7428
ID: 23012533
Just to add a final comment, the print job stopped on about 60 records when I speeded it back up to 5.5 seconds.

Also, I just learned that this same print program used to run on XP successfully, 1000 records/print jobs were no problem.

So, I am back to my initial suspicion in that it was victim of an XP update.  I support another vb6/Crystal 8 application that runs on XP that used to be able to export to Word from Crystal 8.5.  After an XP update about 6 months ago, that is no longer an option without making some registry changes according to the research I've done.

I support many vb6/crystal applications ...

Ok ... we are moving eventually upgrading all our custom apps to .net ... eventually.

So, for now, I'll try a 7 second delay.

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 23014567
Crystal did have problems when XP2 for XP was released.  In fact they recommended if you used Crystal then to not install SP2.

Newer updates to XP may also cause problems.  Since CR8.5 is no longer supported any impact will be borne by the users.

mlmcc
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Loops Section Overview
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 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