Output to pdf using fields (1 Viewer)

bobdydd

New member
Local time
Today, 20:34
Joined
Oct 23, 2012
Messages
5
Hi

I have a routine that outputs an MS Access report as a pdf file which works OK. It does not open the file which is what I want.
DoCmd.OutputTo acReport, "rptTransactionInvoiceExcVAT", acFormatPDF, "C:\Users\JEFF1\Documents\rptTransactionInvoiceExcVAT.pdf", False

What I would like to do is output the pdf file with a Customer name and number from the field Me.txtAmazonBuyer. I have tried:
DoCmd.OutputTo acReport, "rptTransactionInvoiceExcVAT", acFormatPDF, "C:\Users\JEFF1\Documents\" + ([Me.txtAmazonBuyer]) + ".pdf", False

But no joy. Can anyone help?
Thanks
 
Hi
I have tried that but it doesn't do it

Thanks anyway
 
Sorry. I see that "+" and I don't read anything else.
1) If the statement accept to save as acFormatPDF then, as far as I know, is no need that you specify the extension.
2) txtAmazonBuyer seems to be a control ( a text box, I think) in your form. So, no need for brackets.

Try this:
Code:
DoCmd.OutputTo acReport, "rptTransactionInvoiceExcVAT", acFormatPDF,  "C:\Users\JEFF1\Documents\" & Me.txtAmazonBuyer, False
 
here is a line from my code but I have modified to your data, that outputs to a pdf and displays the PDF document, to stop display delete 'True' but leave the comma

DoCmd.OutputTo acOutputReport, "rptTransactionInvoiceExcVAT", acFormatPDF, "C:\Users\JEFF1\Documents\" & Me.txtAmazonBuyer & ".pdf", True, , , acExportQualityPrint
 
Thanks guys for all the prompt help. This is the line that did it for me.
DoCmd.OutputTo acReport, "rptTransactionInvoiceExcVAT", acFormatPDF, "C:\Users\JEFF1\Documents\" & Me.txtAmazonBuyer & ".pdf", False
 

Users who are viewing this thread

Back
Top Bottom