[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 427
  • Last Modified:

MODULE/MACRO TO SEND TO MULTIPLE RECIPIENTS

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.
0
scameron03
Asked:
scameron03
  • 3
  • 2
1 Solution
 
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: www.thedatabaseplace.net/samples.asp

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.
0
 
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
  Else
     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
Loop
0
 
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
0
 
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)" ?
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Yes ... of course, you'll have to have Outlook installed on your machine in order for this to work ...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now