CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Crystal Reports

  1. #1
    Join Date
    Jun 2000
    Location
    South Africa
    Posts
    18

    Crystal Reports

    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.

  2. #2
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: Crystal Reports

    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


  3. #3
    Join Date
    Jun 2000
    Location
    South Africa
    Posts
    18

    Re: Crystal Reports

    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.

  4. #4
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: Crystal Reports

    Show me the code you are using


  5. #5
    Join Date
    Jun 2000
    Location
    South Africa
    Posts
    18

    Re: Crystal Reports

    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.

  6. #6
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: Crystal Reports

    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?


  7. #7
    Join Date
    Jun 2000
    Location
    South Africa
    Posts
    18

    Re: Crystal Reports

    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

    [email protected]

    Real programmers don't comment. If it was difficult to write, it should be difficult to read.

  8. #8
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: Crystal Reports

    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 [email protected]
    Remove nospam
    Cheers


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured