have to restart access after sending one email

  • Thread starter Thread starter Tony Epton
  • Start date Start date
T

Tony Epton

Using Access 2000, outlook express 6

Attempting to automate email for those people who have requested book
scans and scan is older than one month - email asks them to reconfirm
their request

The code below is intended to send multiple emails from highlighted
list box items.
The msgbox in the code successfully displays each attempt - but only
the very first attempt gets emailed, none following and no error
message.
I have to shut down access and restart the program before another
email will go out.

I have turned of "Warn me when other applications attempt to send
email as me" in outlook express


For Each varItm In lst.ItemsSelected
lngRequestId = lst.ItemData(varItm)
RetrieveTemplate Me.cmbEmailTemplate
Set rs = CurrentDb().OpenRecordset("BookRequests")
rs.FindFirst "RequestId = " & lngRequestId
If rs.NoMatch Then
MsgBox "Cannot find book request - cancelled"
Else
strTemplateHeading = Me.TemplateHeading
strTemplateBody = Me.TemplateBody

strTemplateHeading =
EmailSubstitution(strTemplateHeading, rs)
strTemplateBody = EmailSubstitution(strTemplateBody, rs)
strEmailTo = rs!EmailAddress
strEmailToCC = "(e-mail address removed)"
Me.TemplateHeading = strTemplateHeading
Me.TemplateBody = strTemplateBody
DoEvents

DoCmd.SendObject acSendNoObject, , , strEmailTo,
strEmailToCC, , strTemplateHeading, strTemplateBody, False
MsgBox rs!emailaddress
End If
rs.Close
Set rs = Nothing
Next varItm


Any help greatly appreciated
Tony Epton
 
Probably better to ask in an Access forum, since your code has nothing at all to do with Outlook, which is the subject of this newsgroup.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top