timer event

Geoff Codd

Registered User.
Local time
Today, 12:06
Joined
Mar 6, 2002
Messages
190
I've got the following code

Private Sub Sendemail_Click()

Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("Bulk E-Mail")

Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("E-Mail Address").Value
DoCmd.SendObject , , , strEmail, , , Me!Subject, Me!Message, No

NEED TO WAIT 6 SECONDS THEN PERFORM SendKeys "%y"

rsEmail.MoveNext

Loop
Set rsEmail = Nothing

End Sub

I need to insert a timer where it says "NEED TO WAIT 6 SECONDS THEN PERFORM " so that the procedure will wait 6 sends then perform the keystroke.

All help greatly received
Thanks
Geoff
 
You could try a 'For - Next' loop. To make the PC count for a while. I don't know how long six seconds is in 'count' terms though.

Col
 
From the help files for Access 97

This example uses the Timer function to pause the application. The example also uses DoEvents to yield to other processes during the pause.

Dim PauseTime, Start, Finish, TotalTime
If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
PauseTime = 5 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
MsgBox "Paused for " & TotalTime & " seconds"
Else
End
End If


HTH
 

Users who are viewing this thread

Back
Top Bottom