Link to home
Start Free TrialLog in
Avatar of Sharon
SharonFlag for United States of America

asked on

3 second timer

I have an Access database that sends mass emails out of Outlook.  Sometimes it fills up Outlooks sendmail box too fast.  I want to add a 3 second delay.  I have tried this and it locks up Access.  The Access/Outlook interface works fine.  Just trying to get a 3 second delay.  Thanks.


Set rs2 = db.OpenRecordset("qryMassEmailFinal")
If Not rs2.EOF Then rs2.MoveLast
Do Until rs2.EOF

' ***timer
Dim ldteEnd As Date
ldteEnd = DateAdd("s", 3000, Now)
While Now < ldteEnd
Wend
'****
           Set MyOutlook = New Outlook.Application
           Set MyMail = MyOutlook.CreateItem(olMailItem)
            MyMail.To = rs2.Fields("email")
            MyMail.Subject = vubject
            MyMail.Body = vBody
            MyMail.Send

rs2.MoveNext
 Loop
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sharon

ASKER

Excellent!!