Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Nov 2004
    Canberra, Australian Capital Territory, Australia
    Thanked 0 Times in 0 Posts

    Using Access to send mail (XP SP1)

    I am in the process of creating a contacts database for some colleagues who have, to date, been using an Outlook Contacts folder to store their listings. However, with over 3,000 entries (names, addresses, membership of mailing lists, related companies etc) the data was obviously getting far too large to be managed and the duplications and typos etc etc have just made it impossible.

    I have created the database (DAO etc) but am having trouble in one area. They wish to be able to create bulk mailouts that will also have attachments. This is an Australian Government Department that has legitimate reasons to contact its client base who have expressed an interest in being contacted thus so this is definitely not spam.

    I have used elsewhere in other Access databases code that enables a user to send one email to someone already on the Exchange server. However, in this case, we have to be able to send from the server and include one or more attachments. I have tried using code from Microsoft but it refused to allow me to use a variable for the attachment path name(s) but did work if I hard coded that path. Obviously this is not the desired solution! Also many warning messages popped up from Outlook warning me that I could be infected with a virus as my Outlook Contacts list was being used by a third party, even though the addresses I was using are not a part of my Contacts folders.

    Therefore, what I require is code that will do the following:
    a) Place on or more attachments using the equivalent of .Attachments.Add() or anything else that works and
    [img]/forums/images/smilies/cool.gif[/img] Be able to mail out many mails simultaneously with the same attachment(s) or one whatever the case may be (I thought a simple loop through a recordset should be able to satisfy this but by not being able to add an attachment my plans are stymied).

    A final request is that does anyone know how to check the Outlook calendar while in Access to ascertain whether or not a proposed meeting date and time is already booked? This would be great if you do. Once again I have found code that opens up a new Outlook meeting from which the user can input their meeting but I would like to be able to create that meeting in Access, check that that date and time is not already booked and then write that data to both Outlook within the calendar and to an Access table. This I can't do from Outlook alone.

    Thank you

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Crystal Beach, FL, Florida, USA
    Thanked 41 Times in 40 Posts

    Re: Using Access to send mail (XP SP1)

    Checkout PBEmail at
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Mt Macedon, Victoria, Australia
    Thanked 45 Times in 44 Posts

    Re: Using Access to send mail (XP SP1)

    Here is some code (fragments) I use to add an attachment to an Outlook email.

    Dim oMailItem As Outlook.MailItem
    Dim oAttachment As Object
    Dim strAttachment As String
    strAttachment = Me!txtAttachment
    Set oAttachment = oMailItem.Attachments.Add(strAttachment)

    txtAttachment is a textbox on a form, with a browse button so I can select a file as the attachment.

Posting Permissions

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