If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Email using Crystal Report Control

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-23-09, 22:44
ARW ARW is offline
Registered User
 
Join Date: Aug 2003
Location: Auckland - New Zealand
Posts: 9
Question Email using Crystal Report Control

Hi. I have searched heaps of threads but cannot find an answer.

I have placed the "Crystal Report Control" component on a VB5 form, and am able to display a crystal 8.5 report with just the following code.

CrystalReport.DataFiles(0) = txtDataPath
CrystalReport.ReportFileName = txtReportPath & txtReportName
CrystalReport.PrintReport

Now instead of displaying on the screen I would like to email the report (as a pdf). I note that the Crystal Report Control has some Email Properties, so I have set those as follows.

CrystalReport.EMailSubject = "Purchase Order"
CrystalReport.EMailMessage = "Attached is our Purchase Order"
CrystalReport.EMailToList = "accounts@company.co.nz"

Now how do I action? Is there an equivalant to the PrintReport (or Action=1 which also prints).

Or do I have to print to a pdf file, (which I could do by setting printer to cutepdf) and then emailing the file?

Any suggestions, please post example code. I will understand better that way.
Thanks Heaps.
Reply With Quote
  #2 (permalink)  
Old 06-28-09, 03:45
ARW ARW is offline
Registered User
 
Join Date: Aug 2003
Location: Auckland - New Zealand
Posts: 9
Lightbulb Further Progress on Emailing

Ahhh - i have found that it is as simple as adding

CrystalReport.PrintFileType = crptRTF ' Or xls etc - But No pdf option available
CrystalReport.Destination = crptMapi ' Or crptExchange
CrystalReport.PrintReport ' Or CrystalReport.Action = 1 does the same

So now I can send my report as an attachment to an email, and so simply.

Only two problems left
1) I think this method only works with crystal report version 8.5 or less. Is there an equivalent for version 9,10,11? Everything Ive looked at so far is really complicated.
2) How to send the report as a pdf? Can this be added as an option somehow?

Any answers anyone? Cheers.
Reply With Quote
  #3 (permalink)  
Old 06-30-09, 18:18
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
Probably, you'll want to add a PDF print driver, print to a file, then, email the resulting file as an attachment. The Ostrosoft SMTP component works well for this.
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert

Reply With Quote
  #4 (permalink)  
Old 07-05-09, 05:04
ARW ARW is offline
Registered User
 
Join Date: Aug 2003
Location: Auckland - New Zealand
Posts: 9
Thanks Lou - but dont really want to purchase a new component fot that.

Is there an existing way to do it within VB and Crystal anyone?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On