send report with varible name (1 Viewer)

steve111

Registered User.
Local time
Today, 06:16
Joined
Jan 30, 2014
Messages
429
hi

I use a macro that attaches a document automatically to an e-mail address ready to send this report is governed by a query of which the criteria is " loss order number "
this is in a pdf format of which I need if possible

the problem I have is the same pdf file keeps attaching itself to the e-mail no matter which loss order number I select .
the reason I think is because the report is called NCR so it is not changing from the previous one
what I think can solve it but not sure and don't know how to do is get the " loss order number " within the report name
if I just send the report to a file direct it does work as I am prompted for a file name

can the loss order number get into the file name within a macro/vba

thanks
steve

I can send a copy of the database if needed




Code:
 Name="EMailDatabaseObject
 Name="ObjectType">Report
 Name="ObjectName">SEND NCR
 Name="OutputFormat">PDF Format (*.pdf
 Name="To">=[E-mail Address] & IIf(Nz([E-mail Address
 

EdFred

knows enough, dangerous
Local time
Today, 01:16
Joined
Mar 2, 2007
Messages
129
Here's the simple code to rename the report.

It's what I use when making PDF reports of my invoices. Change the report name, Invoice_Number to lossorderfieldname, and directory location as necessary.

Code:
DoCmd.OutputTo acOutputReport, "PDFInv", acFormatPDF, "S:\PDFOutput\Invoice" & Me.Invoice_Number & ".pdf"


This of course assumes you are sending it from a form where you have your loss order number.
 

steve111

Registered User.
Local time
Today, 06:16
Joined
Jan 30, 2014
Messages
429
hi ,

thanks for reply , I have attached the database for you to look at amd hopefully show me where the code should go

I will also have one to do for invoice and order acknowledgment reports to do

the macro is the "run query" this puts the form on the e-mail
but like I said it repeats itself

thanks steve
 

Attachments

  • filter - Copy.accdb
    800 KB · Views: 64

Users who are viewing this thread

Top Bottom