I need to E Mail a Report, Need To Add To Existing Code. See Below. Thanks, Dave

D

Dave Elliott

This code links the form with the report I want to e-mail instead of
printing.
The Customers E-Mail Link is already on the form, the control is named E
Mail
Outlook Express is active E-Mail client. Thanks, in Advance

On Error GoTo Err_Command450_Click

Dim stDocName As String
Dim stLinkCriteria As String

stLinkCriteria = "[Order ID]= Forms![Edit Quote]![Order ID]"

stDocName = "InvoiceReports"

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70

DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
'DoCmd.PrintOut acPage
'DoCmd.Close acReport = "InvoiceReports"

Exit_Command450_Click:


Exit Sub

Err_Command450_Click:
MsgBox Err.Description
Resume Exit_Command450_Click
 
S

SA

Dave:

Basically what you want to do is to filter your report when its emailed;
SendObject doesn't by itself (and the menu items don't either) support
filters on objects being sent. There's two ways to resolve this:

1.) Change your report's underlying query to reference your form's Order ID
text box as the condition for the Order ID field.
2.) Change the query so that it "pulls" the values you want to use a filter
from a module variable in code. You can see how to do this by stopping by
our web and looking in the Code and Design Tips area under Reports for the
tip on how to supply report parameters via code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top