I am attempting to follow the instructions found at the following link:
http://www.granite.ab.ca/access/email/reportsasattachments.htm
I am very stuck. The instructions don't seem to advise on how to send an
email after a certain field on my form is updated. That's o.k., because I
already know how to. I'm using this code to do it.
SendTo = "(e-mail address removed)"
MySubject = "Updated Status Report"
MyMessage = "A Project Status update has been provided for the following
project: " & Me![Proj Name] & Chr$(13) & Chr$(10) & "Please see the attached
report."
DoCmd.SendObject acSendNoObject, , , SendTo, , , MySubject, MyMessage, False
This is all I needed to do before. Now I need to attach the report to the
email too. Soooo, I'm trying to use the following:
DoCmd.OutputTo acOutputReport, "Status Report 3", "Snapshot Format",
"C:\NicolesTest", False
With just this code nothing happens.
Aside: The path name C:\NicolesTest is just temporary until I can get the
code working. What I really want to do is send this file to a network
folder, but I'm trying to take one step at a time. I'm afraid I'll run into
problems trying to accomplish that, but will research it separately if needed.
This is the part that's confusing me...
As advised, I want to put the following in my report's OnOpen event.
Me.Filter = "ShipmentsID=" & Forms![Select Load List]![LoadID]
Me.FilterOn = True
Where ShipmentsID is supposed to be a field in the underlying recordsource
of the form. I'm trying to create a filter that will only return those rows
where ShipmentsID is the same value as what's in a control named LoadID on a
form named Select Load List.
My form's name is Status Report 3 (same name as the name of my report. I
know, goofy, but I have to work with it for now). I have a primary key field
named Report No on both my Form and Query. So I'm thinking my code should
look like this.
Me.Filter = "Report_No=" & Forms![Status_Report_3]![Report_No]
Me.FilterOn = True
Tony Toews said:
Nicole said:
I've reviewed the instructions on how to email reports as attachments, but I
need some help. I'm now trying to change the filter in the OnOpen event.
Your code says...
Me.Filter = "ShipmentsID=" & Forms![Select Load List]![LoadID]
Me.FilterOn = True
I know that I need to replace "ShipmentsID=" with the name of my report,
No. ShipmentsID is the name of the field in your report you want to
filter on. It is the shipment that you want to see on the report.
but
I do not understand what SelectLoadList and LoadID represent.
SelectLoadList is the name of the form which we are using to select
the load list for which we want to print the report. LoadID is the
combo box on that form with the list of loads in it.
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog -
http://msmvps.com/blogs/access/