Report to PDF with Custom Title

Iamrickdeans

Registered User.
Local time
Today, 11:26
Joined
Apr 8, 2013
Messages
29
Hi Everyone,

It's been a while since I posted but I have inevitably hit a brick wall with my re-learning of Access and I am stumped, perplexed, smacking my head off the wall trying to work out the solution (which I feel as soon as it's pointed out I am going to kick myself for)

I am using the built in Access macro editor to run a number of reports which are called for arguments sake ClientPartA, ClientPartB etc...

My macro so far simply opens on a button click each of these reports and populates a number of text fields (all this is working fine)

Where my problem lies is I then want to export each of these reports to a central network location
"L:\Operations Database\Projects\1042\Outputfile\

I have been using the command 'ExportWithFormatting'

and have filled out the macro element with;

Object Type: Report
Object Name ClientPartA
Output Format: PDF Format (*.Pdf)
Output File: L:\Operations Database\Projects\1042\Outputfile\
Auto Start: No
Template File (no info)
Encoding (no info)
Output Quality Print


Now all my data is pulling from a form called 'Client' and the field 'RecipientsAccountNumber'

I thought I would be able to export the file(s) as PDF with

the output file being written as;

Output File: L:\Operations Database\Projects\1042\Outputfile\ Forms![Client]![RecipientsAccountNumber] & " - ClientPartA"

saving the form to the named directory as '300300300 - ClientPartA'

What in reality is happening is it's saving the file to the named directory not as a PDF and with the file name of 'Forms![Client]![RecipientsAccountNumber]



I cannot fathom it, any help massively appreciated! Any further details required I will happily supply!


Thank you in advance,


Richard
 
You need to concatenate the values..
Code:
Output File: "L:\Operations Database\Projects\1042\Outputfile\[COLOR=Red][B]" & [/B][/COLOR]Forms![Client]![RecipientsAccountNumber] [COLOR=Red][B]& "[/B][/COLOR] - ClientPartA"
 
Hi Paul

You've helped me before buddy and it's really appreciated I had tried your code before and it still errors out on me...

If I change the output file to a specific value for example

L:\Operations Database\Projects\1042\2011Outputfile\300

it saves the value as 300.PDF

However I tried your varient and I get multiple errors, if I change the code slightly I get a non PDF file saved in location with the & Forms section added to it...

I am massively confused...


I am using access 2010 if this differs from the version you are using?
 
What is coming up is two pop up windows the one at the back reads

Now outputting

'ClientPartB' to the file

'L:\Operations Database...\2011Outputfile\ & "Forms!xxxx[RecipientsAccountNumber]"


The window on top then reads

Microsoft Access Can't save the output data to the file you've selected.

*The file may be open...
*If you are using a template (which i'm, not)
*If the file isn't open, check to make sure you have enough disk space (gigabytes of it)
*Makesure the file exists on the path specified (well the direcory exists I'm trying to create the file)
*Check to make sure you have permission to write to the specified folder. (I own the L drive so pretty sure it's not that)


Stumped
 
You need to concatenate the values..
Code:
Output File: "L:\Operations Database\Projects\1042\Outputfile\[COLOR=red][B]" & [/B][/COLOR]Forms![Client]![RecipientsAccountNumber] [COLOR=red][B]& "[/B][/COLOR] - ClientPartA"


Having tried

Output File: "L:\Operations Database\Projects\1042\Outputfile\" & Forms![Client]![RecipientsAccountNumber] & " - ClientPartA"

I also tried

Output File: "L:\Operations Database\Projects\1042\Outputfile\" & Forms![Client]![RecipientsAccountNumber] " & " - ClientPartA"

No joy...
 
Make sure you have put .pdf after the file name.. fileName.pdf

Would you be comfortable to do this in VBA? instead of Macro?

Code:
Private Sub buttonName_Click()
    DoCmd.OutputTo acOutputReport, "ClientPartA", acFormatPDF, "L:\Operations Database\Projects\1042\Outputfile\" & _
    Forms![Client]![RecipientsAccountNumber] & " - ClientPartA.pdf"
End Sub
 
Make sure you have put .pdf after the file name.. fileName.pdf

Would you be comfortable to do this in VBA? instead of Macro?

Code:
Private Sub buttonName_Click()
    DoCmd.OutputTo acOutputReport, "ClientPartA", acFormatPDF, "L:\Operations Database\Projects\1042\Outputfile\" & _
    Forms![Client]![RecipientsAccountNumber] & " - ClientPartA.pdf"
End Sub


Converted code to VBA and the problem is resolved... The answer you gave was so very close to what I had been doing, I am just going to kick myself...

On a serious note, the help you provide is incredible to me and loads of others. Until I am in a position to provide the same kind of help that you do to others. I thank you immensely!

Kind Regards

Richard
 
Most welcome Richard. Glad to be of assistance.

Someday you will do the same. :) Good luck !
 

Users who are viewing this thread

Back
Top Bottom