Stuart ~ Thanks a million for your reply!
I tried to do what you said but it didnt work .....I've played with it, so
now it is at least working and pulling from the query, but just the first
entry. I could not get the LOOP or go to END OF FILE to work for me.
I have no idea where this code came from, a friend gave it to me and asked me
to see if I could get it to work from a query. I'm waiting to hear back from
him to answer your question. Perhaps you can understand from the full code
below. Can you teach me how to make it work, pulling the entire field from
the query? I would be most grateful, sir!
' ************************************************** ******************************
Public Sub testCDO()
Const cdoSendUsingPort = 2
Const cdoBasic = 1
Dim objCDOConfig As Object, objCDOMessage As Object
Dim strSch As String
strSch = "http://schemas.microsoft.com/cdo/configuration/"
Set objCDOConfig = CreateObject("CDO.Configuration")
With objCDOConfig.Fields
.Item(strSch & "sendusing") = cdoSendUsingPort
.Item(strSch & "smtpserver") = "smtp.server.Com"
.Update
End With
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Query1", dbOpenSnapshot)
Set objCDOMessage = CreateObject("CDO.Message")
With objCDOMessage
Set .Configuration = objCDOConfig
.From = "Hugh Mailbox"
.Sender = "hu***********@usa.com"
.To = rs![email]
.Subject = "Hugh Message"
.HTMLBody = "Here is the body of Hughs email"
.send
End With
Set objCDOMessage = Nothing
Set objCDOConfig = Nothing
End Sub
' ************************************************** **************************************
Stuart McCall wrote:
>Hi All ~ First time posting.
[quoted text clipped - 13 lines]
>Your help is appreciated
Hugh
First make sure you have a reference to 'Microsoft DAO 3.6 Object Library'
(In the VBE, Tools->References), then:
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset(Query1, dbOpenSnapshot)
Set objCDOMessage = CreateObject("CDO.Message")
With objCDOMessage
Set .Configuration = objCDOConfig
Do Until rs.EOF
.From = "PSS Mass Mail Mailbox"
.Sender = "hu***********@usa.com"
.To = rs!email
.Subject = "Hugh Message"
'...
.MoveNext
Loop
rs.Close
Set rs = Nothing
Just to satisfy my curiosity, what is objCDOConfig?
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200801/1