Hi all
I last touched Access about 9 years ago when I was quite good and I wrote a number of successful databases. As I no longer us it I have just discovered the level of skill fade that I have acquired when a friend asked me to update a database that I wrote for him (that's how I know it was 9 years ago!).
He has requested the following update:
1. Create a PDF from a specific report automatically. I'm stuck!
2. Attach it to an email. The email needs to auto send the email in the back ground (through Outlook is fine). I think that this is OK
3. save a copy of the PDF locally. I can do this
4. Update the database that the email is sent. This is easy!
As I have the database working fine and creating a print preview of the required report (I have set link criteria to get the correct report which can have a single or a number of record sets) I am stuck on how I can get VB to create the PDF from the report?
My research has revelled using DoCmd.OutputTo acOutputReport but I am stuck on how to get it to PDF the current report with the correct record set?
I can post my current attempts if required? I current get a message "The current OutputTo action was cancelled"
The lines that I think are causing the problem (all based on snippets that I have researched) are
-----------------------------------------------------------------------------
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.OutputTo acOutputReport, "", acFormatPDF, MyPath & MyFilename, False
------------------------------------------------------------------------------
I have all of the strings declared earlier in the code.
Any advice and guidance from the experts will be appreciated. How do I PDF the current report please?
I last touched Access about 9 years ago when I was quite good and I wrote a number of successful databases. As I no longer us it I have just discovered the level of skill fade that I have acquired when a friend asked me to update a database that I wrote for him (that's how I know it was 9 years ago!).
He has requested the following update:
1. Create a PDF from a specific report automatically. I'm stuck!
2. Attach it to an email. The email needs to auto send the email in the back ground (through Outlook is fine). I think that this is OK
3. save a copy of the PDF locally. I can do this
4. Update the database that the email is sent. This is easy!
As I have the database working fine and creating a print preview of the required report (I have set link criteria to get the correct report which can have a single or a number of record sets) I am stuck on how I can get VB to create the PDF from the report?
My research has revelled using DoCmd.OutputTo acOutputReport but I am stuck on how to get it to PDF the current report with the correct record set?
I can post my current attempts if required? I current get a message "The current OutputTo action was cancelled"
The lines that I think are causing the problem (all based on snippets that I have researched) are
-----------------------------------------------------------------------------
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
DoCmd.OutputTo acOutputReport, "", acFormatPDF, MyPath & MyFilename, False
------------------------------------------------------------------------------
I have all of the strings declared earlier in the code.
Any advice and guidance from the experts will be appreciated. How do I PDF the current report please?