have to restart access after sending one email

T

Tony Epton

Access 2000, outlook 2000

I'm attempting to streamline voluntary book scanning.
Periodically I want to send an email to people whose request is older
than a month to reconfirm that they still want the manual scanned.

The code below successfully sends out just one email and then I need
to shut it down and restart it before it will be capable of sending
out another.
I have turned off warnings in outlook


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 = "[email protected]"
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

Many thanks in advance
Tony Epton
 
Top