Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Automatic Emails from ADP Form 1

Status
Not open for further replies.

Aliffi

MIS
Jan 9, 2005
51
0
0
BE
Dear All,

I am trying different methods to send auto emails based on my ADP form (my back database is SQL SERVER 2000)

here is an almost done CODE, but the problem is it repeat sending the email for only first record
can any one please fix it to read the next record as well
and then send the email again
'-----------------------------------------------------

Private Sub Command27_Click()

Set myrecordset = Me.RecordsetClone
With myrecordset
myrecordset.MoveFirst

Do Until myrecordset.EOF

DoCmd.SendObject acSendNoObject, , , "farzam.aliffi@cec.eu.int", , , "Job Alert", "Dear " + [TaskM] + vbCrLf + "Please carry on with the following Task " + vbCrLf + "------------------------------------------------" + vbCrLf + vbCrLf + [Task] + vbCrLf + vbCrLf + "------------------------------------------------" + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + "Regards," + vbCrLf + "Database Section ", No

myrecordset.MoveNext
Loop
End With
Set myrecordset = Nothing

End Sub
 
Replace this:
Set myrecordset = Me.RecordsetClone
with this;
Set myrecordset = Me.Recordset

OR, replace the controls reference by recordset reference, eg:
myrecordset![TaskM], myrecordset![Task]


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV , Thank you very much for your kind reply

I did it with replacing

Set myrecordset = Me.RecordsetClone

here is the final code

'------------------------------------------------------
Set myrecordset = Me.Recordset
With myrecordset
myrecordset.MoveFirst

Do Until myrecordset.EOF

DoCmd.SendObject acSendNoObject, , , "farzam.aliffi@cec.eu.int", , , "Job Alert", "Dear " + [TaskM] + vbCrLf + "Please carry on with the following Task " + vbCrLf + "------------------------------------------------" + vbCrLf + vbCrLf + [Task] + vbCrLf + vbCrLf + "------------------------------------------------" + vbCrLf + vbCrLf + vbCrLf + vbCrLf + vbCrLf + "Regards," + vbCrLf + "Database Section ", No

myrecordset.MoveNext
Loop
End With
Set myrecordset = Nothing
'----------------------------------------------------

thanks dude
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top