Send Object

J

Johnny

I am trying to send a report from a form using DoCmd.SendObject. But I am
having difficulty in making a filter or a "Where-condition" for this
function. When I push the button the access send all reports (175) in one
mail, but I want it to send only one at a time.

Is there anyone who have some experience with this?

Johnny
 
R

Rick Brandt

Johnny said:
I am trying to send a report from a form using DoCmd.SendObject. But I am
having difficulty in making a filter or a "Where-condition" for this
function. When I push the button the access send all reports (175) in one
mail, but I want it to send only one at a time.

You have a few options.

You can use the Open event of the report to apply a filter to itself based on a value
on a form or stored in a global variable.

You can modify the report's query so that it uses criteria from same sources as above
to filter the result set to the desired record.

You can exploit a particular behavior of Access Reports. That is, if you Preview,
Print, or Export a report that is already opened in preview mode with a filter
applied, that same filtered output is what you will get. So if you use
DoCmd.OpenReport to bring the report on-screen with the desired filter and then
immediately use SendObject against the same report, the filter will still be in
effect for your SendObject copy. I'm not sure if this method is completely reliable
though. I usually go with the public variable method myself.
 

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