Posted on 2005-04-15
Last Modified: 2008-01-09
Hi guys, i have a query "sendpromotxt" which selects the  cellular numbers of customers from a particular table only. I would like to create a SendObject macro or something similar which would take the numbers from the query and then send to the recipients all in one go.
NB: I have a software (part of Outlook 2003, called eSMS executive) which can send SMS text messages. I need Access to know that the SendObject or whatever module for the cellular numbers has to Output to this application to all the recipients from the query.
Question by:scameron03
    LVL 84
    You won't be able to do this with SendObject, I think. You'll have to automate Outlook to do this. There's a sample on my website that shows how to do this:

    I have no idea how you would interface with eSMS ... I'm assuming this is an add-in written by someone and installed with Outlook. If that's the case, find out if eSMS is VBA-Enabled ... if it is, the developer's should have some sort of documentation that would detail how to interface with it.

    Author Comment

    I was given this code as a possible solution, but there sems to be a problem with the Outlook libarary reference...

    Dim rs As Recordset
    Dim strEmail, strSubject As String, strBody As String
    Dim objOutlook As outlook.Application
    Dim objEmail As outlook.MailItem

    Set rs = CurrentDb.OpenRecordset("Select Email, SMS From Query1")
    Set objOutlook = CreateObject("Outlook.application")

    Do While Not rs.EOF
      Set objEmail = objOutlook.CreateItem(olMailItem)
      If Trim(rs!SMS) & "" <> "" Then
         strEmail = rs!SMS
         strEmail = rs!Email
      End If

      strBody = "This is body text"
      strSubject = "Subject"
      With objEmail
        .To = strEmail
        .Subject = strSubject
        .Body = strBody
        .Send 'Will cause warning message
      End With
      Set objEmail = Nothing
    LVL 84
    Do you have a reference to Outlook on your machine?

    The sample at the link I gave above uses code that is similar but doesn't require an Outlook reference ... the code you posted uses both Early and Late Binding (for some reason) and really should be reworked to use one or the other

    Author Comment

    No reference i'm afraid, i'll use yours instead. I presume the link on your site you're referring to is: "Using Outlook from Access (41 kb)" ?
    LVL 84

    Accepted Solution

    Yes ... of course, you'll have to have Outlook installed on your machine in order for this to work ...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    This isn't a frequent question on EE. I must have seen it three or four times (among several thousand questions). However, I use this trick quite often, most frequently as a delayed Current event. A form does not expose it's calculation dependenc…
    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now