I'm getting an error code when I click my button that says
"Compile error: Sub or Function not defined". How do I prevent this?
FYI I'm trying to email a report based on a number if a table called tblEmail. One report for each line in the table. Thanks.
Mike
Private Sub Command79_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim vIPA_NUM As String
Set db = CurrentDb
Set rs = db.OpenRecordset("tblEmail", dbOpenDynaset)
rs.MoveFirst
Do
vIPA_NUM = rs("IPA_NUM")
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT DATA1.* INTO [1 rpt_Summary] FROM DATA1 WHERE (((DATA1.IPA_NUM)= '" & vIPA_NUM & "'))", -1
DoCmd.SendObject acSendReport, "1 rpt_Summary", "MicrosoftExcelBiff8(*.xls)", rs("Email_Address"), "", "", "1 rpt_Summary", "Please find attached your report", True
rs.MoveNext
Loop Until rs.EOF
rs.Close
db.Close
End Sub
"Compile error: Sub or Function not defined". How do I prevent this?
FYI I'm trying to email a report based on a number if a table called tblEmail. One report for each line in the table. Thanks.
Mike
Private Sub Command79_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim vIPA_NUM As String
Set db = CurrentDb
Set rs = db.OpenRecordset("tblEmail", dbOpenDynaset)
rs.MoveFirst
Do
vIPA_NUM = rs("IPA_NUM")
DoCmd.SetWarnings False
DoCmd.RunSQL "SELECT DATA1.* INTO [1 rpt_Summary] FROM DATA1 WHERE (((DATA1.IPA_NUM)= '" & vIPA_NUM & "'))", -1
DoCmd.SendObject acSendReport, "1 rpt_Summary", "MicrosoftExcelBiff8(*.xls)", rs("Email_Address"), "", "", "1 rpt_Summary", "Please find attached your report", True
rs.MoveNext
Loop Until rs.EOF
rs.Close
db.Close
End Sub