Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to Capture Cancel on Crystal Parameter Dialog Box

Posted on 2002-04-19
16
Medium Priority
?
952 Views
Last Modified: 2008-05-09
I am Using VB 6.0 code with Crystal Reports 8.
My problem is that I have set in the Cruystal report some parameters (starting date, ending date etc...)

When I run the report through VB and try to cancel the
Report by clicking the cancel button  I still get the report running!
How can I capture this cancel & stop the report in its tracks ?

jules
0
Comment
Question by:Jules_Madgwick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +5
16 Comments
 
LVL 18

Accepted Solution

by:
mdougan earned 200 total points
ID: 6953569
I've tried to use their cancel button and it never seems to work.  So, I think that there is an option you can set that will keep their cancel button from appearing.

The only thing that I've gotten to work, is that I put my crystal report control on a special non-modal form, and when I go to run the report, I'll load the form and run the report (if you're not doing print-preview, you don't have to show the form, just load it, if you are doing print-priview, you can attach the Crystal preview window to that form, so that you have more control over the Crystal preview window).  If the user wants to cancel, they would click a button on the form that they used to invoke the report, and all it does is unload the form with the Crystal Report control on it and set the form = nothing.  Doing this flushes Crystal from memory, and hopefully will stop your report from running.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 6953619
listening
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 6971220
Are you refering to the CANCEL button on the print setup form from VB?  If so there is no way to capture the cancel click.  Once you activate the report from VB it will run to completion.

To avoid this I built my own Print Setup form and then have full control over the CANCEL button.

If this is what you want I'll be happy to post the code for the form and the calling routines.

good luck
mlmcc
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Jules_Madgwick
ID: 6975700
Yes, I am trying to cancel thee print from Crystals own dialogue box.  Whether I enter my parameters in or not as soon as I hit cancel the report tries to run.
I still want the Crystal Dialogue box!  but if the only way to cancel a print is to have my own Print & Parameter Setup then yes  would appreciate your code. Thank you
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7660543
Hi Jules_Madgwick,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept mdougan's comment(s) as an answer.

Jules_Madgwick, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 7665473
Do you still need the code?

mlmcc
0
 

Expert Comment

by:SpideyMod
ID: 7755319
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
 

Expert Comment

by:presbria
ID: 8151947
Hey jules,

I too had this problem for awhile, but recently figured it out.  I'm not sure if it'll work for all versions of Crystal, but it's worth a try.

Apparently, the .PrinterName property of the Crystal Report Control is set as a Null string by default and can only be set by code, or when the user hits "Ok", not "Cancel" on the .PrinterSelect popup box!!!

So,

    crReport.PrinterSelect
    If crReport.PrinterName <> "" Then
        crReport.PrintReport
        crReport.PrinterName = ""  'back to default
    End If

works like a charm!!!

Don't for get to set the PrinterName back to "" as if a user prints and then choose cancel the next time, the PrinterName will still be the printer selected from the prior print action.

Who thought making the Crystal Report Control work that way was a good idea????

Brian
0
 

Author Comment

by:Jules_Madgwick
ID: 8156716
Ok not quite what I'm looking for.
On the Parameter dialogue there is a cancel button this is the one I would like work.
0
 

Expert Comment

by:Nele77
ID: 8548716
I have the same Problem, I want to cancel the report during the Parameter dialogue is shown, but nothing happens when I click the cancel button - has anyone a solution for this problem??
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8554274
Look at


http://groups.msn.com/McCrackenUNO

You may have to join the group.  Look in Documents then Expert Exchange files

The way I use it is to display the form modal then when the user clicks Cancel or Print I hide the form and then can use the informatiion entered from the CRViewer.

If you need more help let me know and I'll post the code from one of my printing routines.

mlmcc
0
 

Author Comment

by:Jules_Madgwick
ID: 8555246
This Code from Presbria work well but only if you want to see the windows Printer Setup GUI.
Still is not the right solution as far as I'm concerned but can get you out of a tricky situation.

   CrystalReport1.PrinterSelect
   If CrystalReport1.PrinterName <> "" Then
       CrystalReport1.PrintReport
       CrystalReport1.PrinterName = ""  'back to default
   End If

put this code in instead of your CrystalReport1.Action = 1
0
 

Author Comment

by:Jules_Madgwick
ID: 8555248
Presbria I should have awarded you points - Sorry
0
 

Expert Comment

by:tmcconn
ID: 12586791
Does anyone know how to do this in Visual Foxpro?
I've tried to guess at the code change but go zilch

Thanks,
T
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 12590400
tmcconn: I see you are a new user.  It is customary to ask your own questions.  On the left side there is a link Ask A Question.  Click it and you will be able to ask a question.

According to Crystal you cannot capture the click of the CANCEL from the Crystal Printer Select after clicking the print button.  The report will click.

mlmcc


0
 

Expert Comment

by:tmcconn
ID: 12594129
Thanks mimcc,

Yeah, I figured that out and posted my own question   http://www.experts-exchange.com/Databases/FoxPro/Q_21207443.html#12589355

Thanks to CarlWaner I got what I needed. I included the final solution so check it out for reference.

Thanks again,
Troy
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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

610 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