Click to See Complete Forum and Search --> : Crystal Reports
baldric
June 14th, 2000, 01:49 AM
Help me! (Deadline passed already)
I am printing reports designed in Crystal 5 from VB6. (Compatibility problem?) After I have successfully printed one of the reports, and I close a form, I get an error 28: "Out of stack space". Do I need to 'close' the crystal reports object or something?? My code is simply
crpFinance.PrintReport
The path etc. is hardcoded in at design time.
Is PrintReport the correct method?
Thanks
Real programmers don't comment. If it was difficult to write, it should be difficult to read.
TH1
June 14th, 2000, 02:03 AM
If your Crystal Report Control is called Cr1 then to print it do the following
Cr1.destination=crptToWindow
'the destination cam also be CrptToFile/CrptToPrinter/CrptMapi or CrptExchange
Cr1.Action=1
This will print your Report to the Screen
Hope This Helps
baldric
June 14th, 2000, 10:49 AM
Thanks, I am not getting the error 28 anymore. Unfortunately, I am getting an illegal operation instead.
Please help me! Good ratings for this one I reckon.
Thanks
Real programmers don't comment. If it was difficult to write, it should be difficult to read.
TH1
June 15th, 2000, 01:28 AM
Show me the code you are using
baldric
June 15th, 2000, 03:17 AM
thanks for your help.
my code is simply
'about 4 or 5 reports in this form, hence
'the use of Index as integer
rptAddresses(index).PrintReport
and that's all.
The path and destination is set at design time in the report properties. I tried yesterday the method you showed me.(rptAddresses(index).destination... , followed by rptAddresses(index).action = 1) etc., but instead of the error 28, I got an illegal operation.
I am using Crystal 5, with VB6. I have created the reports in Crystal and saved them, then placed Crystal Report Objects for each report I use. (Probably not wonderful programming, I know)
I am printing to a window at the moment.
I am using an Access97 database, accessed with SQL queries etc. It seems that I can safely print 1 report, and then close forms without any problem. However, should I print more than one report, I get those errors etc. (I think printing the same report more than once might not cause errors, but I'm not sure.) I can't think of any more info to give you, except that a friend of mine, who is pretty clued up in this, thinks that Crystal 5 might not be compatible with VB6.
Any more ideas?
Thanks for your help.
Real programmers don't comment. If it was difficult to write, it should be difficult to read.
TH1
June 15th, 2000, 03:21 AM
The way that I'd do this is
rptAddresses(index).reportfilename="Whatever"
rptAddresses(index).destination=crpttoWindow
rptAddresses(index).action=1
That's about as simple as it gets
What is the "illegal operation" that you are getting?
baldric
June 15th, 2000, 04:32 AM
What exactly is the difference between action=1 and PrintReport? What other actions are there?
I am at work now, and my program is on my home PC, so I don't know exactly what the error is. I tried to write it down yesterday, but I was having other PC problems, and couldn't access VB.
Something about out of memory. (Pentium MMX 233, 32MB, 7GB over 2 HDD's) I think I will try a newer version of Crystal. I will also try to catch that illegal operation message again.
Are you on IRC at all? Can we rather Email or chat? This is awfully slow.
Thanks for your help
kevin@wandata.com
Real programmers don't comment. If it was difficult to write, it should be difficult to read.
TH1
June 15th, 2000, 04:41 AM
Printreport returns a value which is 0 if the report prints successfully and another number if it fails.
using .Action basically does the same thing except that it will cause a run time error if he report fails to print and you will have to put error handling in your procedure.
The only value for action is 1
Without knowing what the error you got was I can't really help you much more.
If you want to email me you can get me at hayes_tony@nospamhotmail.com
Remove nospam
Cheers
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.