I have a button on a form screen that is used to email a report on a regular basis to a list of department chairmen. Everything worked fine until I modified a couple of tables in the database. Now when I click the button I get the following message: "Too few parameters. Expected 1." After modifying the tables, I also modified the queries and reports that were affected. The query and the report mentioned in the following code opens just fine. Does anyone have a clue as to what could cause this error. I compacted and repaired the database and that did not help.
Code:Private Sub cmdEmail_Click() On Error GoTo ErrHandler Dim db As DAO.Database Dim rs As DAO.Recordset Dim Employee As DAO.Field Dim Employee2 As DAO.Field Dim Location As DAO.Field Set db = CurrentDb Set rs = db.OpenRecordset("qryESOLDeptChair4Email", dbOpenDynaset) Set Employee = rs![EmailAdd] Set Employee2 = rs![FullName] Set Location = rs![SchName] Do While rs.EOF = False gstrEmployeeName = Employee2 DoCmd.SendObject acSendReport, "rptEmailAllSchoolsWithProf", acFormatSNP, Employee, , , "Attached ESOL Roster for " & [Location], "The attached file contains CONFIDENTIAL student information and should ONLY be opened and saved on a School System Computer. Right click on the attachment and select open.", True rs.MoveNext Loop DoCmd.SetWarnings True ExitHandler: On Error Resume Next gstrEmployeeName = "" Set Employee = Nothing Set Employee2 = Nothing rs.Close Set rs = Nothing Set db = Nothing Exit Sub ErrHandler: MsgBox Err.Description Resume ExitHandler End Sub