Results 1 to 6 of 6
  1. #1
    beckysright is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    9

    If and Multiple Email Attachments

    Hi everyone, I am new to this programming language and I mean really new so please be patient with my lack of knowledge.

    I have a form and I have added a checkbox to see what the person wants emailed. I need to be able to send out multiple attachments depending on what check boxes they select. This is the code I have so far.

    It is working with just one attachment but not multiple.

    Private Sub EmailCapabilities_Click()

    Dim objol As Object
    Dim objmail As Object


    Set objol = CreateObject("Outlook.Application")
    Set objmail = objol.createitem(0)
    With objmail
    .To = "email"
    .bcc = "email"
    .Subject = "NIS Capabilities Statement"
    .Body = "Dear " & FirstName & " " & LastName & ": " & "I have attached the NIS Capabilities Statement, for your convenience. Please feel free to contact me with any questions you may have."
    .NoAging = True
    If Me.CapStmt = Yes Then
    Set objOutlookAttach = .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities Statement.pdf")
    End If
    If Me.CapList = Yes Then
    Set objOutlookAttach = .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities List.pdf")
    End If
    If Me.CapMaint = Yes Then
    Set objOutlookAttach = .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities Maintenance Statement.pdf")
    End If
    .Display
    End With
    Set objmail = Nothing
    Set objol = Nothing

    End Sub

    Thank you so much!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Review
    http://www.tek-tips.com/faqs.cfm?fid=1634
    http://www.pcreview.co.uk/forums/ema...-t3496042.html

    I don't think you need the Set for attachments. Try:

    If Me.CapStmt = Yes Then .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities Statement.pdf")
    If Me.CapList = Yes Then .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities List.pdf")
    If Me.CapMaint = Yes Then .Attachments.Add("C:\Users\Physician Source 4\Documents\personal\NIS Capabilities Maintenance Statement.pdf")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    beckysright is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    9
    June,

    Thank you so much for your reply. I have been hitting refresh like crazy in the hopes to get this done before work is over.

    I have changed it (thank you so much!) but now when I click on the capstmt it will attach the other two but not capstmt and if I click caplist it attaches capstmt and capmaint. Could you help me please?

    Thank you!

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Don't understand behavior of the checkboxes. Are they bound to fields? Want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    beckysright is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2012
    Posts
    9
    Got it! -1 and 0 instead of yes/no! Thanks!

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Think I have encountered that before and found that True/False works instead. I don't use checkboxes much.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access sending email attachments
    By wee irish in forum Access
    Replies: 1
    Last Post: 03-06-2012, 06:11 PM
  2. problem with importing email attachments to access
    By funi.t in forum Import/Export Data
    Replies: 1
    Last Post: 12-20-2011, 10:20 AM
  3. Send email with attachments not empty
    By JJCHCK in forum Programming
    Replies: 3
    Last Post: 09-23-2011, 10:29 AM
  4. Send email with attachments
    By rbiggs in forum Programming
    Replies: 12
    Last Post: 07-23-2011, 12:50 PM
  5. Send Report and Attachments in Email
    By Pimped in forum Programming
    Replies: 1
    Last Post: 06-21-2011, 02:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums