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.
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
Yes ... of course, you'll have to have Outlook installed on your machine in order for this to work ...
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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.
scameron03Author Commented:
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
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
scameron03Author Commented:
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)" ?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.