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

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

Delta7428Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
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
Delta7428Author Commented:
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
Delta7428Author Commented:
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
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

mlmccCommented:
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
Delta7428Author Commented:
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
mlmccCommented:
You might put a delay in the loop.

Is it failing on the last one?

mlmcc
0
Delta7428Author Commented:
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
mlmccCommented:
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
Delta7428Author Commented:
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
mlmccCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Delta7428Author Commented:
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
mlmccCommented:
I agree it is not ideal but since you are using older technology (VB6 and CR8) it may be the only solution.

mlmcc
0
Delta7428Author Commented:
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
Delta7428Author Commented:
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
mlmccCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.