Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calling outlook help (access 2003)

    I'm going back to an earlier post where I wanted to attach more than 1 thing to an email from access. The code below works but It will auto send the email. I want to be able to edit the email before it's sent. I'm looking to have the email open before it's sent. I tried a few things with th .send line but nothing worked. Any thoughts? Thanks..

    Dim appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    With MailOutLook
    .To = "gbanks@ets.org"
    .Subject = "Hey..."
    .HTMLBody = "Check It Out

    "
    .Attachments.Add "C:tempdb2.xls", olByValue, 1, "db2"
    .Attachments.Add "C:tempdb1.zip", olByValue, 1, "Thing"
    .Send
    End With

  2. #2
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling outlook help (access 2003)

    Use .Display instead of .Send. You can then send it manualy from there.
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calling outlook help (access 2003)

    For future reference: it would have been better to post your new question as a reply in the previous thread (starting at <post:=666,330>post 666,330</post:> ) since it is a follow-up question.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling outlook help (access 2003)

    Sorry about that Hans. I am very close to completeing this. I pasted the top part of my code below.. I was using the stlinkCriteria to show only the one record on the CPRreport that I eant to attach. It would pull this number from the form. It worked before when I used sendobject but I'm not sure how to use it now that I'm calling outlook. Any thoughts? Thanks..


    stLinkCriteria = "EIRID=" & Chr(34) & Me("EIRID") & Chr(34)

    This is the old code i used for DoCmd.SendObject

    'DoCmd.SendObject acReport, "CPRReport", "RichTextFormat(*.rtf)", "", "", "", "Site CPR Attached", "If you have any questions please respond to this email. Thank You...", False, stLinkCriteria

    New part

    DoCmd.OutputTo ObjectType:=acOutputReport, _
    objectname:="CPRReport", _
    OutputFormat:=acFormatRTF, _
    OutputFile:="F:CPRReport.rtf", _
    Autostart:=True

    im appOutLook As Outlook.Application
    Dim MailOutLook As Outlook.MailItem
    Set appOutLook = CreateObject("Outlook.Application")
    Set MailOutLook = appOutLook.CreateItem(olMailItem)

    With MailOutLook
    .To = "gbanks@ets.org"
    .Subject = "Batch Releases"
    .HTMLBody = "Hello"
    .Attachments.Add "F:no CPR.doc", olByValue, 1, "Incomplete test no CPR"
    .Attachments.Add "f:TempCPRReport.rtf", olByValue, 1, "CPRReport_rpt.rtf"
    .Display
    End With

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calling outlook help (access 2003)

    I'm afraid your use of stLinkCriteria in SendObject is invalid - the last argument specifies an HTML template, not a where-condition.

    You'll have to change the record source of the report to a query that selects the desired record. The criteria for the EIRID field in the query would look like this:

    [Forms]![NameOfForm]![EIRID]

Posting Permissions

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