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.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"rico" <(E-Mail Removed)> wrote in message
news:58C3D481-2F5D-4AA0-ADC7-(E-Mail Removed)...
>
> 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