I have the following code attached to a button on a form to email a report to one location at a time until the end of the file is reached. The program is not paying attention to the line containing the "Do Until rst.EOF" note and was giving me a 2105 error when it reached that point. I was able to make it work by using the ErrHandler to stop execution when the error is 2105 but I would like to know what was wrong that my EOF code so that it would not stop the loop process.
Private Sub Email2Sch_Click()
On Error GoTo ErrHandler
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("qrySchContacts")
Dim emailto As String
emailto = Forms!frmEmail!ContactEMail
Do Until rst.EOF
DoCmd.SendObject acReport, "rptSchoolErrors", "RichTextFormat(*.rtf)", emailto, "", "", "SASI Errors", "Please See the Attached Report. Right click on it, choose open and MS Word will convert it from Rich Text Format", False, ""
DoCmd.GoToRecord , , acNext
Loop
Exit Sub
ErrHandler:
Select Case Err
Case 2105 'End of File
Exit Sub
DoCmd.Close "frmEmail"
DoCmd.Quit
Case Else
MsgBox Err.Description, vbExclamation
Resume
End Select
End Sub



