Email Attachment - specific records, not entire table

G

Guest

In the database I have inhertied/tweaked, I have several reports that are
based on a specific record in a table. I can preview a report that contains
only 1 record; however, if I try to use the sendobject method, I get the
whole table in the report not the specific record. Any ideas how I can
limit this without creating a query for each value?????

I am thinking it is something that I can pass the report when it is
formatting, but I am ot sure how to do that. The table contains a list of
service tickets. I want to email the service ticket to my field supervisor
(instead of printing it) and anyone else who wants it. So far, instead of
getting the 1 page service ticket report, I get a complete listing of the
1000+ tickets that are currently in the database. If I can get this figured
out, I can implement in other areas of the database as well and eliminate the
need to cut down as many trees as we do in the office.

Any help would be appreciated.
 
R

Rob Parker

Hi Don,

I'm not about to offer a complete solution, but since there's been no other
replies, maybe this will help.

The SendObject method can only send an existing object, and does not allow
for you to pass any parameters to that object - in your case, a Report. So
you can't do the equivalent of
DoCmd.OpenReport "reportname",,,WhereCondition

My workaround for this is to, in code on the SendReport button, open the
report (hidden) in design mode, set its recordsource to the single record I
want, save the report, then send the (now modified to give only the record I
want) report. If you need a code example, post back and I'll supply one.

HTH,

Rob
 
S

SA

Rob / Don:

Actually there's a better way to do this, so that you set your filter
dynamically, even though the sendmail method doesn't support filters. Take
a look at the following KB article, which describes faxing a filtered
report. You can use the same filtering method to send the report via e-mail
normally.

http://support.microsoft.com/kb/299016/en-us
 
G

Guest

Thanks for the help Rob and Steve.

I'll give them a try and see what happens.

Rob - I think I know what you were describing. Hopefully, between the 2, I
can get something that works.

THanks again

Don
 

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