Jules_Madgwick
asked on
How to Capture Cancel on Crystal Parameter Dialog Box
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
listening
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
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
ASKER
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
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
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
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
Do you still need the code?
mlmcc
mlmcc
per recommendation
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
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
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
ASKER
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.
On the Parameter dialogue there is a cancel button this is the one I would like work.
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??
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
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
ASKER
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.PrinterSele ct
If CrystalReport1.PrinterName <> "" Then
CrystalReport1.PrintReport
CrystalReport1.PrinterName = "" 'back to default
End If
put this code in instead of your CrystalReport1.Action = 1
Still is not the right solution as far as I'm concerned but can get you out of a tricky situation.
CrystalReport1.PrinterSele
If CrystalReport1.PrinterName
CrystalReport1.PrintReport
CrystalReport1.PrinterName
End If
put this code in instead of your CrystalReport1.Action = 1
ASKER
Presbria I should have awarded you points - Sorry
Does anyone know how to do this in Visual Foxpro?
I've tried to guess at the code change but go zilch
Thanks,
T
I've tried to guess at the code change but go zilch
Thanks,
T
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
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
Thanks mimcc,
Yeah, I figured that out and posted my own question https://www.experts-exchange.com/questions/21207443/Checking-for-Cancel-button-click-when-printing-Crystal-report-from-visual-Foxpro.html#12589355
Thanks to CarlWaner I got what I needed. I included the final solution so check it out for reference.
Thanks again,
Troy
Yeah, I figured that out and posted my own question https://www.experts-exchange.com/questions/21207443/Checking-for-Cancel-button-click-when-printing-Crystal-report-from-visual-Foxpro.html#12589355
Thanks to CarlWaner I got what I needed. I included the final solution so check it out for reference.
Thanks again,
Troy