Emailing report with new file name each time

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
I'd use a form to select an invoice number then run the report. The criteria
for the report's query would have something like below in the invoice column.
[Forms]![FormName]![txtInvoiceNumber]

Then change your code to read something like:
newinvoice = "emailinvoice-" & [Forms]![FormName]![txtInvoiceNumber]

For this to work, the form must remain open until the report is sent. The
form can be invisible though.
 
Thanks jerry, but i think you missunderstood my question, my problem is not
the code i entered - i have a form open with [invoiceno] on it where the user
build the invoice - but that i'm looking for an alternative.

Cheers tho

Jerry Whittle said:
I'd use a form to select an invoice number then run the report. The criteria
for the report's query would have something like below in the invoice column.
[Forms]![FormName]![txtInvoiceNumber]

Then change your code to read something like:
newinvoice = "emailinvoice-" & [Forms]![FormName]![txtInvoiceNumber]

For this to work, the form must remain open until the report is sent. The
form can be invisible though.
--
Jerry Whittle
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


rico said:
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
 
Back
Top