crystal error crashing VB 6.0 when viewing multiple reports

Posted on 1999-07-16
Medium Priority
Last Modified: 2011-09-20
created 2 reports in crystal using a different table in each. I've got
them on a drop down menu. The menu click code for them is:

CrystalReport1.action = 1   and CrystalReport2.action = 1

If I only view one (either) of the reports when I run it, everything
fine. But if I view BOTH, I get the following error message when I close the program and VB
gets shut down entirely. (I can go to other forms before closing and
there is no problem, just when I close the program.):

VB6 caused an invalid page fault in
module CRYSTL32.OCX at 0137:250127fb.
EAX=00000000 CS=0137 EIP=250127fb EFLGS=00010202
EBX=0064146c SS=013f ESP=007ff3dc EBP=007ff46c
ECX=00000000 DS=013f ESI=00641274 FS=0f87
EDX=006412ac ES=013f EDI=00000000 GS=0000
Bytes at CS:EIP:
c7 41 04 00 00 00 00 c3 56 8b f1 83 79 04 00 74
Stack dump:
2500e831 00641284 00641274 00000000 25003832 00641274 25003765
00641274 2501ca30 00000001 00000006 0175f9b4 0041eb1b 00641280
0000105c 0175f9b4

Is there a solution for this?

Question by:dtmaurer
  • 3
  • 2

Accepted Solution

apratima earned 600 total points
ID: 1525296
Yes it happens, which is you can say is drawback of using two crystal controls simultaneously.
In Normal cases what we do is we call report from a form and after completing the report viewing we come back to same form, means yuor form is not yet unloaded.
But in this case where we use 2 crystal controls simultaneously as soon as you write statements

you should write

Unload Me

Which will solve your problem. If You don't want it this way
Other solution is as follows.
Don't use 2 crystal controls. You can do it with single crystal control as follows:

After you say


Again write the code for setting values for another report using the same control and again say


In this case you Don't have to Unload current form.
If you think explaination is not sufficient or have any doubts regarding this you can ask I will explain in details.


Author Comment

ID: 1525297
I have changed my code as follows:

Private Sub mnuCustomerReport_Click()
CrystalReport1.Action = 1
Unload Me
End Sub

Private Sub munInventoryReport_Click()
CrystalReport2.Action = 1
Unload Me

But when I click on the menu, the report opens but then disappears with the form and the
program ends.  Have I understood your instructions correctly?
End Sub


Expert Comment

ID: 1525298
No no, ..
Are U placing Your crystal controls on the main form?
And directly running the report after selecting menu option?
I think yes.
I am Sorry.
I thought it other way
You have to change your program little bit, follow steps
1)Don't directly place controls on the main form from where you are invoking the menu.
2)When you click the menu option for report display a form in which you will place your crystal control.
You can also place two Command Buttons "Start" and "Cancel" or something simillar on that form.
3)In your start button you can give necessary code for displaying a report (which right now you are coding in menuitems click events)
Unload me is not needed in that case because you will be using only one crystal control for that particular form.
4)Repeat the steps 1-3 for all the reports you have in your program.
5)Remove the code CrystalReport1.Action and whatever from your Menu items click event instead you have to say

The advantage of following this method is
1)In future if you like to pass some parameters to your report by taking input from user You can do it by placing desired controls on your form (having Crystal Control)
2)All the time you will not be using each and every report but as soon as your Main Form gets loaded all the crystal controls will also be loaded in memory and will stay there untill your application ends which is not advisable.

Okay, If you need any help on this don't hasitate to email me, b'cos I may not be able to log on this site frequently during weekends.


Expert Comment

ID: 1525299
Isn't it a long time since you havn't gave any comment for my comeent

Author Comment

ID: 1525300
Sorry for the delay.  I used only one control and changed the report info in the menu click event.  Thanks so much!

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

624 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