[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

VB6 and CR 9   Emailing a .rpt

Posted on 2011-09-27
6
Medium Priority
?
349 Views
Last Modified: 2012-05-12
Is it possible to run a crystal report using the crviewer in vb (already done) and email a copy of the report without having to export as a PDF first?
0
Comment
Question by:Jeff_Kingston
[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
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Brook Braswell
ID: 36710192
Without exporting to "something" I would say not you can not email a report simply from what is viewed on the screen.  If you already know how to make the pdf, that would be the best way to go.  You do not have to have the users interaction to do so.  If you have a button on screen, you could make the PDF and send the email in the background as long as you have a recipient and a sender address.
0
 

Author Comment

by:Jeff_Kingston
ID: 36710453
That sounds great, do you know where I could grab sample code?
0
 
LVL 14

Expert Comment

by:Brook Braswell
ID: 36710593
I use a tool called CodeStone to send emails with.

Public MySMTP As New SMTPClient
              Public MyPop3 As New POP3Client

              With New_Report
                   ' SHOULD YOU REQUIRE A PARAMETER FOR YOUR REPORT
                   .ParameterFields(1).AddCurrentValue Str(YOUR PARAMETER)
                   .ExportOptions.PDFExportAllPages = True
                   .ExportOptions.DestinationType = crEDTDiskFile
                   .ExportOptions.DiskFileName = "YourFilePath\" & sYourFileName & ".pdf"
                   .ExportOptions.FormatType = crEFTPortableDocFormat
                   .DisplayProgressDialog = False
                   .Export False
              End With

              Dim MyMsg As New CSMAILLib.MESSAGE

              MyMsg.Subject = sSubject
              MyMsg.To(1) = sRecipient
              MyMsg.From(1) = sSender
              ' SHOULD YOU HAVE CC OR BCC IN YOUR MAIL
              MyMsg.CC(1) = sCC  
              MyMsg.bCC(1) = sBCC
              Dim sSection As CSMAILLib.Section
              MyMsg.Sections(1).Body = Trim(sBody)
              Set sSection = MyMsg.Sections.Add
              sSection.AttachBodyFromFile ("YourFilePath\" & sYourFileName & ".pdf")
              ' for some exchange servers the user and pass are not required
              MySMTP.ConnectESMTP sSMTPServer, "", "", "", sSMTPPort  ' For Exchange 2010
              ' else use a user pass for a mail server
              MySMTP.ConnectESMTP sSMTPServer, sPOP3User, sPOP3Pass, sPop3Login, sSMTPPort
              MySMTP.SendMessage MyMsg
              MySMTP.Close

              ' when you are done it does not hurt to kill the file afterwards to keep things clean
              Kill ("YourFilePath\" & sYourFileName & ".pdf")

Open in new window

0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
LVL 14

Expert Comment

by:Brook Braswell
ID: 36710898
BTW - here is a link to the for the email tool
http://www.codestone.co.uk/
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 36713068
If you are using  MAPI mail system like Exchange you can load the MAPI export dlls and mail it directly from the viewer.  It goes as an attachment and the attachment can be a PDF.

Code is similar to the above except you choose the MAPI option and attachment format.

mlmcc
0
 

Author Closing Comment

by:Jeff_Kingston
ID: 36716160
Thanks for the direction.. seems pretty straight forward
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

650 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