Results 1 to 9 of 9

Thread: Question About Email in VB....

  1. #1

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Wink

    Dear All...

    I would like to ask about the combination of crystal report and email system.
    Here goes the problem.
    I've a report designed at crystal report 7.0.
    And if the user click print the report, my program will automatically make the report to be an attachment, and will automatically send to an email address.

    Can I do that in VB 6.0 ??? If I can, HOW ???

    Cheers,
    Wen Lie
    Regards,
    [-w-]

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Cool Save it to a file

    Wen,

    You can, from VB, select the destination of the report.

    REPORT.DESTINATION = 2 will send the report to a file instead of to the printer. You will also need to set the REPORT.PRINTFILENAME property and the type of file it is to print to - see the PrintFileType property to do that.

    I'm using Crystal 8 but I can't believe they'd bodge around with such fundamental properties.
    Anakim

    It's a small world but I wouldn't like to paint it.

  3. #3

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Wink Thx... but...

    Well... anakim...

    Thx.. for your suggestion...
    But, I already know about it....
    I know how to print to file.
    But, now, what I need is...

    Whenever the user click print button at crystal report,
    my VB program will automatically print the report to printer, and at the same time, will create a file, and then my VB program will automatically send the file created to an email address (the spesific email address).

    do you know how to do it anakim ???

    Thx,
    nd Cheers,
    Wen Lie
    Regards,
    [-w-]

  4. #4
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Smile

    Right I know what you're getting at now!

    How about putting some code in the crystal viewers 'PrintButtonClicked' event to dump the report out to a file.

    If you have outlook you could use the Outlook Object library (msoutl9.olb) to send the email....

    Set oOutlook = CreateObject("Outlook.Application")
    Set oMailItem = myOlApp.CreateItem(olMailItem)
    Set oAttachment = oMailItem.Attachments

    oAttachment.Add "C:\Reports\Rep1.rpt", _
    olByValue, 1, "A Report"

    oMailItem.Body = "Here's your report"
    oMailItem.To = "[email protected]"
    oMailItem.Send

    If you're not using outlook then you could always start ! Sorry, we use outlook so there's been no need to look for alternatives.

    Hope that's a little more useful than the previous cak I posted.

    Anakim

    It's a small world but I wouldn't like to paint it.

  5. #5
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Red face PS

    Erm hope you hadn't got bored of waiting for a reply, neglected to check my email for a couple of days.

    Ooops!
    Anakim

    It's a small world but I wouldn't like to paint it.

  6. #6
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    What the hell is Crystal Report???
    I got it with VB and I don't know what the hell it does!
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  7. #7
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    Cool

    Crystal's just a tool which enables you to produce professional looking reports. It's quite easy to link it to a DB and extract a load of info, while changing the selection parameters at run time.

    If you use Access as the DB then probably you are best using Access' reports but if using an industry DB (Oracle/Informix) then it's very useful.

    Have a look at Seagate's site if you want more info....
    http://www.seagatesoftware.com/products/crystalreports/
    Anakim

    It's a small world but I wouldn't like to paint it.

  8. #8

    Thread Starter
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Wink Thx...

    Thx... anakim...

    I will try the code...
    nd will contact you, if I've got trouble with the code.

    Cheers,
    Wen Lie
    Regards,
    [-w-]

  9. #9
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    You can also use the MAPI controls that comes with VB.
    With them you can send e-mail with any MAPI enabled e-mail client.
    Just add them to a form and use code simular to this:
    Code:
        MAPISession1.SignOn
        MAPIMessages1.SessionID = MAPISession1.SessionID
        MAPIMessages1.Compose
        MAPIMessages1.RecipAddress = "[email protected]"
        MAPIMessages1.RecipDisplayName = "Someone AnyBody"
        MAPIMessages1.MsgSubject = "Report"
        MAPIMessages1.MsgNoteText = "The report is attached"
        MAPIMessages1.AttachmentPathName = "C:\ThePath\TheReportFileName"
        MAPIMessages1.Send
        MAPISession1.SignOff
    Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width