Is there a way to do something to only part of a recordset. I want to send a mail only to a certain number of people and then go back to a form. Ive tried the following but if doesnt work:
Set rs = db.OpenRecordset("Select * from [tblStudents] where tblStudents.[STU_TU_CODE] = " & "'" & retiring & "';")
rs.MoveLast
total = rs.RecordCount
half = total / num
Do While rs.RecordCount >= half
If Not IsNull(rs("STU_EMAIL")) Then
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
addresses = rs("STU_EMAIL")
With objOutlookMsg
.Recipients.add (addresses)
.subject = "Change of Tutor"
.Body = strbod
.Send
End With
End If
rs.MoveNext
Loop
Any ideas?
Set rs = db.OpenRecordset("Select * from [tblStudents] where tblStudents.[STU_TU_CODE] = " & "'" & retiring & "';")
rs.MoveLast
total = rs.RecordCount
half = total / num
Do While rs.RecordCount >= half
If Not IsNull(rs("STU_EMAIL")) Then
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
addresses = rs("STU_EMAIL")
With objOutlookMsg
.Recipients.add (addresses)
.subject = "Change of Tutor"
.Body = strbod
.Send
End With
End If
rs.MoveNext
Loop
Any ideas?