Robert Wardlow
asked on
email PDF from currently open form
I need to output the currently open Access form to a pdf and attach it to an email.
The code below will create a pdf from a named report and attach it to an email:
DoCmd.SendObject acSendReport, [name of report], acFormatPDF, "recipient@company.com",[c c email(s)],[bcc email(s)], [Message Subject], [MessageBody], True
Is it possible to print the currently open access form to a pdf attachment in an email?
Thank you in advance for your help.
The code below will create a pdf from a named report and attach it to an email:
DoCmd.SendObject acSendReport, [name of report], acFormatPDF, "recipient@company.com",[c
Is it possible to print the currently open access form to a pdf attachment in an email?
Thank you in advance for your help.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the OutputTo to print a form BUT it does NOT offer a where argument so it will print everything. The ONLY way this will work, as I mentioned earlier, is if you have used selection criteria in your form to select only the record you are viewing. I don't believe filters will work. Every record in the Form's RecordSource will end up in the pdf.
ASKER
Thank you Pat. I understood. The forms in question only have 1 record in the RecordSource.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for this example Helen. However, I am aware of all of the reasons why it is better to use a report for this purpose. I asked this question to see if someone knew how to create a pdf from a form. I have specific reasons. Apparently it is not possible.
Thank you very much for your help.
Thank you very much for your help.
ASKER
I assume this is not possible since no one answered my question.
Thank you
Thank you
You can "print" to a PDF printer or use OutputTo. But OutputTo ONLY works if the recordset of the form is controlled by criteria in its RecordSource. Filters will not work.
I tried exporting a form to PDF (there is such an option) in the interface, and while there were no error messages, the PDF was entirely blank. If I have some time later on, I will experiment with creating a PDF from a form in code, just to see if it is possible.
ASKER
Thank you Helen, I appreciate your help. I have started using the print dialog in Acrobat manually. It would have been nice to be able to automate the whole process like you can with reports but that doesn't seem to be possible.
Thanks again.
Bob
Thanks again.
Bob
ASKER
Thanks again.