change filename output of sendobject

G

Guest

Hi all,

i want to be able to send a report "emailinvoice" by email but with the
invoice number as part of the file name eg. emailinvoice-346.

At the moment i'm using the sendobject function to export the report. The
ony way i can think of doing what i want, is to create a new report each time
the report is emailed doing something like this.

Dim newinvoice as string
newinvoice = "emailinvoice-" & Me.invoiceno
CreateReport newinvoice, emailinvoice
Docmd.sendobject acreport, newinvoice etc etc

Then delete the report i have created once it has been sent. But this would
make my users front ends expand in size extremely quickly and need compacting
repairing more than a few times a day, plus i'm sure there is a more
efficient way of doing this, any ideas??

TIA

Rico
 
A

Allen Browne

Rico, my experience is that Access uses the Caption of the report as the
name, or or Name of the report if there is no caption. Although you can set
the report's Caption in its Open event, that seems to be too late, i.e. that
does not affect the file name.

You might like to try experimenting with renaming the report:
DoCmd.Rename "Invoice 346", acReport, "Invoice"
and see if that is less bloating than creating and destroying it.

I don't know if you can get away with doing that in an MDE, but anything
that prevents you from creating an MDE for your users is not a suitable
generic development technique.
 
G

Guest

Thanks Allen,

The renaming works quite well, doesn't bulk it up too much, well not as much
as creating/deleting! gonna trail it for a couple of days, see how it goes.

Also might try exporting the details to a word template, thought i read
something a while back about doing it, know anything about it?

Thanks again for the help.

Rico
 
A

Allen Browne

Rico, I personally avoid that kind of DDE interchange between Word and
Access, so others might be able to suggest how to avoid the pitfalls there.

Personally, I find that kind of thing too unstable to use.
 

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