Basic Send Current Record Report function...

RickDB

Registered User.
Local time
Today, 12:28
Joined
Jun 29, 2006
Messages
101
Hello,

Hopefully no one is irritated by *another* send report by e-mail post, but everyone I see is for doing much more than what I need and I cannot get the code to work.

I would post the send code I have, but it is so broken I think it would be useless for figuring this out. I have tried several different ways to get this to work, and each one gives me a different set of errors / undesired results.

I have provided the VBA used for printing current report - works perfect (for illustration purposes only)
Private Sub cmdPrintReport_Click()

On Error GoTo Err_cmdPrintReport_Click

Dim stDocName As String
Dim strWhere As String

strWhere = "[OrderID]= " & Me.[OrderID]
stDocName = "rptCompleteOrder"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport stDocName, acNormal, , strWhere

Exit_cmdPrintReport_Click:
Exit Sub

Err_cmdPrintReport_Click:
MsgBox Err.Description
Resume Exit_cmdPrintReport_Click

End Sub

All I want to do is send a simple, one page report based on the current form's OrderID to 4 static e-mail addresses (as is done in the print command above). There will be no variable mailing list, as these are all inter-office personnel and we have no turnover.

I would prefer to send the page in HTML or Snapshot format.

Now, I have been looking at posts on how to get the report to be into the e-mail's body as opposed to being an attachment, but for all the trouble I am having with the simple attachment, I will open that can of worms later... Although I it seems silly something like that wouldn't be a simple function built into Access!

Thanks for any replies!
 
Last edited:
Rick, there is a function

docmd.sendobject

it attaches the report(or query/table etc) to the email (its a parameter to the command)
there is a variety of attachment options (html, xls, rtf, etc)
you can add text to the email
you can specify a to list, cc list, bcc list etc

not sure how you out a where clause in though, i think you wil have to specify that as a parameter in the report query source.
 

Users who are viewing this thread

Back
Top Bottom