Email a Report, Please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have been working on this and it may be over my head. I need to set up a
cmd-btn that the user can use to send a report. Im working on the DoCmd.send
but I cant get it. Here is what I have now. But I get a Compile error. What
am i messing!?

Private Sub cmd_btn_email_daily_rpt_Click()
DoCmd.SendObject , Daily_Rpt, , "(e-mail address removed)", , , "Daily Report", , , True
End Sub

Any help would be great

Thanks
Keith
 
Hi,
If you look up the syntax in Help, you have to specify the object type and the
report name is a string so...
DoCmd.SendObject acSendReport, "Daily_Rpt", , "(e-mail address removed)", , , "Daily Report", , True
 
OK,

I now have the code like this

DoCmd.SendObject acSendReport, Daily_Rpt.rtf, , "(e-mail address removed)", , , "Daily
Report", , , True

I see that I needed to add the acSendReport and why. I also see in the help
that I need to tell it the format that it needs to me in so I put it in rich
text. with the above code I get the following:

Compile Error
Variable not defined.

I'm think that I have not told it the format in the right format.

Thanks
 
Hi,
From Help:
outputformat One of the following intrinsic constants:
acFormatHTML
acFormatRTF
acFormatTXT
acFormatXLS
If you leave this argument blank, Microsoft Access prompts you for the output format.

You cannot simply make things up and supply them as arguments :-)
 
....and the second argument needs to be the (string) name of the report. So
1) it needs to be in speech marks and 2) you don't have a report called
Daily_Rpt.rtf (not allowed... at least not in A2K)
 
Good catch.
KAnoe, please read the replies carefully and pay attention the what the help
files say! You didn't even implement the changes I suggested in my earlier post.
 
OK Dan. I thought I did. On my code I his not have the "acSendReport" in the
code. I thought this was the change. I will read both the email and the help
again. Sorry if I missed it. I find that by the time I get it I look back and
see that I should have seen it in the first palce. I think that is what is
going on here.

Thanks Keith
 
GOT IT!! Thanks DAN and Rob!!!!!

KAnoe said:
OK Dan. I thought I did. On my code I his not have the "acSendReport" in the
code. I thought this was the change. I will read both the email and the help
again. Sorry if I missed it. I find that by the time I get it I look back and
see that I should have seen it in the first palce. I think that is what is
going on here.

Thanks Keith
 
Back
Top