J
Jake F
I'm trying to run a macro to run a code in my module, but get this error. I
changed the code to a different function and it ran it in this module so i
know it's something to do with my code either the titles or references or
something. I called the code from the macro using the ... button so i know
it's named right in the macro which leaves me to my code. Here it is,
hopefully you can see what I can't. Thanks.
Public Function MissedOpps()
On Error GoTo Err_MissedOpps
Dim Output As String
Dim Frm As String
Dim SendTo As String
Dim Subject As String
Dim Body As String
Output = "Missed Opps" & Format(Date, "yyyy_mm_dd")
Frm = [frmReportRu]
SendTo = Frm![Emailto]
Subject = Frm![Subject]
Body = Frm![Body]
'Output file
DoCmd.OutputTo acOutputQuery, "Missed Opps", ".xls", Output
'Send file
DoCmd.SendObject acSendQuery, "Missed Opps", ".xls", SendTo, , ,
Subject, Body, no
'Enter date into last run field on form
Forms![FrmReportRun]![Last Run] = Date
Exit_MissedOpps:
Exit Function
Err_MissedOpps:
MsgBox Err.Description
Resume Exit_MissedOpps:
End Function
changed the code to a different function and it ran it in this module so i
know it's something to do with my code either the titles or references or
something. I called the code from the macro using the ... button so i know
it's named right in the macro which leaves me to my code. Here it is,
hopefully you can see what I can't. Thanks.
Public Function MissedOpps()
On Error GoTo Err_MissedOpps
Dim Output As String
Dim Frm As String
Dim SendTo As String
Dim Subject As String
Dim Body As String
Output = "Missed Opps" & Format(Date, "yyyy_mm_dd")
Frm = [frmReportRu]
SendTo = Frm![Emailto]
Subject = Frm![Subject]
Body = Frm![Body]
'Output file
DoCmd.OutputTo acOutputQuery, "Missed Opps", ".xls", Output
'Send file
DoCmd.SendObject acSendQuery, "Missed Opps", ".xls", SendTo, , ,
Subject, Body, no
'Enter date into last run field on form
Forms![FrmReportRun]![Last Run] = Date
Exit_MissedOpps:
Exit Function
Err_MissedOpps:
MsgBox Err.Description
Resume Exit_MissedOpps:
End Function