Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

? on ActiveX Control for CR in Access form

Status
Not open for further replies.

lynnd

MIS
May 3, 2002
23
US
Hello,
I have created a Crystal Report (v8.5) that will be accessed by end users through Microsoft Access (2000). The end users need the means to: 1) preview, 2) print, and 3) save to a file. I've included the ActiveX control for Crystal (Crystl32.ocx) and included the code for them to do the functions mentioned above.

The problem is that I want them to be able to choose a printer when they print instead of the report always going to their default printer. I found the method for
Code:
 .PrinterSelect
in the Crystal developr.hlp file, but if they press "Cancel" in the choose printer dialog box, the report still prints to their default printer.

Does anyone know how I can capture the "Cancel" event in this instance? I thought some sort of if/then statement like the following might work:
Code:
With CrystalReport1
     If .PrinterSelect <> &quot;Cancel&quot; Then
          .PrintReport
     End If
End With
but everything I've tried so far is to no avail.
Please help... Thanks!
Lynn
 
Hi Lynn,
Actually, I am trying to do something similar to what you did, but somehow this does not work properly. What's the code you are using in Access 2000 for the Viewer etc.? I would really appreciate your help!
Thanks,
Roberto
 
Hey guys,

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 &quot;Ok&quot;, not &quot;Cancel&quot; on the .PrinterSelect popup box!!!

So,

crReport.PrinterSelect
If crReport.PrinterName <> &quot;&quot; Then
crReport.PrintReport
crReport.PrinterName = &quot;&quot; 'back to default
End If

works like a charm!!!

Don't for get to set the PrinterName back to &quot;&quot; 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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top