SendObject

  • Thread starter Thread starter PeterM
  • Start date Start date
P

PeterM

I have code in a form that opens a report and sends it to an email recipient.
I use:

DoCmd.SendObject _
acSendReport, _
Me.ReportCalled, _
me.ReportTypeDesc, _
Me.EmailAddress, _
, _
, _
Me.EmailSubject, _
Me.EmailMessage, _

This code generates an error saying the output type is invalid.
Me.ReportTypeDesc is set to acFormatRTF. I verified this in debug mode.
When I change the code to:

DoCmd.SendObject _
acSendReport, _
Me.ReportCalled, _
acFormatRTF, _
Me.EmailAddress, _
, _
, _
Me.EmailSubject, _
Me.EmailMessage, _

it works fine. Is it not possible to use a variable to contain the
outputtype of the report being emailed?

Thanks for your help!
 
I suspect you have set Me.ReportTypeDesc to the string "acFormatRTF" but in
fact
acFormatRTF is a constant itself that represents the string "Rich Text
Format (*.rtf)"
 
PeterM said:
I have code in a form that opens a report and sends it to an email
recipient.
I use:

DoCmd.SendObject _
acSendReport, _
Me.ReportCalled, _
me.ReportTypeDesc, _
Me.EmailAddress, _
, _
, _
Me.EmailSubject, _
Me.EmailMessage, _

This code generates an error saying the output type is invalid.
Me.ReportTypeDesc is set to acFormatRTF. I verified this in debug mode.
When I change the code to:

DoCmd.SendObject _
acSendReport, _
Me.ReportCalled, _
acFormatRTF, _
Me.EmailAddress, _
, _
, _
Me.EmailSubject, _
Me.EmailMessage, _

it works fine. Is it not possible to use a variable to contain the
outputtype of the report being emailed?

Thanks for your help!
 
Back
Top