Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / September 2007

Tip: Looking for answers? Try searching our database.

Emailing from a query.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lydia - 12 Sep 2007 18:44 GMT
William5271 had the same question I do:

I need to send emails from an access database, but I want to send them from a
query so that I only email the certian people. Access says that it can't send
an email from a query.

However, he didn't tell us how he figured it out.  I'd love to hear how he
did it.
Pieter Wijnen - 12 Sep 2007 20:21 GMT
You can build code on a recordset based on the Query

Something like

Public Sub EmailQuery()
 Dim Db As DAO.Database
 Dim Qdef As DAO.QueryDef
 Dim Rs As DAO.Recordset
 Dim ToList As Variant

 ToList = Null
 Set Db = Access.CurrentDB
 Set Qdef = Db.QueryDefs("MyQuery")
 Set Rs = Qdef.OpenRecordset(DAO.dbOpenSnapshot)

 While Not Rs.EOF
    ToList = (ToList + ",") & Rs.Fields("EMail").Value
    Rs.MoveNext
  Wend
   Rs.Close : Set Rs = Nothing
   Set QDef = Nothing
   Set Db = Nothing
   Access.DoCmd.SendObject bcc:=ToList, Subject:="The Specials",
MessageText:="A Message for you Rudi"

End Sub

HTH

Pieter

> William5271 had the same question I do:
>
[quoted text clipped - 6 lines]
> However, he didn't tell us how he figured it out.  I'd love to hear how he
> did it.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.