Send Form as PDF from Command Button (1 Viewer)

aldeb

Registered User.
Local time
Today, 08:51
Joined
Dec 23, 2004
Messages
318
In Access 2003 you can have a form open and Click:
File
Send To
Mail Recipient as Adobe Pdf.

That works good. I have been asked to see if we cannot
accomplish the same thing from a Command Button on the Form.
Anyone got any ideas? I have researched and searched and
have not been able to come up with anything.
 

randommetalguy

Registered User.
Local time
Today, 08:51
Joined
Nov 25, 2008
Messages
52
Code:
Private Sub cmdSendPDF_Click()
    DoCmd.SendObject acSendForm, "frmName", acFormatPDF, "to@email.com", "cc@email.com", "bcc@email.com", "Subject", "Body", True
End Sub

This is working for me right now. Unless you close the email without sending, it crashes the program >_<.
 

aldeb

Registered User.
Local time
Today, 08:51
Joined
Dec 23, 2004
Messages
318
This is the code I have with the command button. When this fires I get the box that
wants me to select formats:
HTML
Excel
Text files
RTF

I do not have the option to PDF it. Any suggestions?

Code:
DoCmd.SendObject acSendForm, "BucketEcnOutsideDateFrm", acFormatPDF, "to@email.com", "cc@email.com", "bcc@email.com", "Subject", "Body", True
 

rainman89

I cant find the any key..
Local time
Today, 08:51
Joined
Feb 12, 2007
Messages
3,015
You do have a pdf converter on your machine correct?
 

aldeb

Registered User.
Local time
Today, 08:51
Joined
Dec 23, 2004
Messages
318
Yes I do. I Have Acrobat 8 and also Pdf Writer. Does that have anything to do with the
Code above? Right now I am really stumped.
 

aldeb

Registered User.
Local time
Today, 08:51
Joined
Dec 23, 2004
Messages
318
I get the same thing whether or not it is a report or a from. When I fire the code a popup comes up and wants me to select the type and pdf is not one of them.
 

rainman89

I cant find the any key..
Local time
Today, 08:51
Joined
Feb 12, 2007
Messages
3,015
it seems that access2003 does not have a pdf option

Output Format The type of format you want used for the included object. You can select HTML (*.html), Microsoft Excel (*.xls), Microsoft Excel 5-7 (*.xls), Microsoft Excel 97-10 (*.xls), Text (*.txt), Rich Text Format (*.rtf), Microsoft Access Data Access Page (*.htm, *.html), or XML (*.xml) in the Output Format box. Modules can be sent only in text format. Data access pages can only be sent in HTML format. If you leave this argument blank, Access prompts you for the output format. Note You can't include objects in Microsoft Active Server (*.asp) or Microsoft IIS (*.htx, *.idc) format, although these selections are displayed in the list.

Try using this

http://www.lebans.com/reporttopdf.htm
 

aldeb

Registered User.
Local time
Today, 08:51
Joined
Dec 23, 2004
Messages
318
When I select File and then Send to - I get the option to send to recipient as a pdf.
Do you know where that is coming from?
 

aldeb

Registered User.
Local time
Today, 08:51
Joined
Dec 23, 2004
Messages
318
Also, Lebans needs to install dll's and my IT department is not going to allow that as
there will be several people who will need to have them installed.
 

aldeb

Registered User.
Local time
Today, 08:51
Joined
Dec 23, 2004
Messages
318
I guess the dll's do not need to be installed but this requires a report instead of a form.
I need to send the form.
 

rainman89

I cant find the any key..
Local time
Today, 08:51
Joined
Feb 12, 2007
Messages
3,015
I guess the dll's do not need to be installed but this requires a report instead of a form.
I need to send the form.

You can get the same information on a report as you can on a form...
 

suitejudyb

New member
Local time
Today, 13:51
Joined
Jun 8, 2009
Messages
5
Hi. Found the following an easy way to email forms as PDf files as I don't have the option to 'send as pdf either'.
Download a free PDF converter from the internet - something like Cute PDF. To save a form as a PDF go to 'print' and the PDF converter appears in your list of printers. Enter the record number you want to convert and save it in a new folder- it will be in PDF format (it won't actually print). Then you can attach it to an email as you would any other document. That's what happens with mine anyway, dead easy!
Good luck. Judy
 

AlisonG

New member
Local time
Today, 13:51
Joined
Apr 12, 2010
Messages
8
Hello

I've found this thread really helpful, thank you. However, I have a tiny problem that I don't how to resolve. I want to email a Purchase Order Form in PDF format to my supplier detailing the items I want to purchase, however, when I do it sends ALL my Purchase Order forms! Does anyone know of any way of just sending the one form?

My commands are
On Error Next,
Send Object Form,,PDF Format(*.pdf)

Any help would be much appreciated!

Alison
 

Allanf

New member
Local time
Today, 13:51
Joined
Jun 13, 2011
Messages
1
Hi

Ime new to the forum so hello to everyone. I have created a command button using the code below to send the currently displayed form as a pdf attachment in an e-mail

Private Sub PDF_Click()

DoCmd.SendObject acSendForm, "PUCHASE ORDER (supplier copy)", acFormat"to@email.com", "Subject", "Body", True

End Sub

I am getting the same problem as Allison in that when it fires it attaches all records rather than just the record displayed in the form.
For the record I am ussing access 2003

I notice this thread has been dorment for a while but I would be really greatfull if anyone has any ideas to solve this issue

Thanks

Allan
 

bcmarshall

Registered User.
Local time
Today, 05:51
Joined
Jul 17, 2010
Messages
92
I can give you an answer you may not want to hear. Upgrade to Access 2007. It will convert the document to a .pdf, attach it to a mail, and you can even set the outgoing address, subject line, and outgoing message. One click opens your email with the document ready to send. I loved Access 2003, but it's one feature on 2007 that has it beat.
 

soldier2gud4me

New member
Local time
Today, 16:51
Joined
Aug 6, 2019
Messages
1
Code:
Private Sub cmdSendPDF_Click()
    DoCmd.SendObject acSendForm, "frmName", acFormatPDF, "to@email.com", "cc@email.com", "bcc@email.com", "Subject", "Body", True
End Sub

This is working for me right now. Unless you close the email without sending, it crashes the program >_<.


Place a command button with caption "." (It is named in the code as command60) Set its properties to "Transparent".

When the user clicks the Send command button, it will lose focus and make the command button invisible then display it after the error message is gone.

Private Sub CmdSendPDF_Click()
On Error GoTo Err_CmdSendPDF_Click
Me.Command60.SetFocus
Me.CmdSendPDF.Visible = False
DoCmd.SendObject acSendForm, "frmName", acFormatPDF, "to@email.com", "cc@email.com", "bcc@email.com", "Subject", "Body", True
Me.CmdSendPDF.Visible = True
Exit_CmdSendPDF_Click:
Me.CmdSendPDF.Visible = True
Exit Sub
Err_CmdSendPDF_Click:
MsgBox Err.Description
Resume Exit_CmdSendPDF_Click
End Sub
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 08:51
Joined
Feb 19, 2002
Messages
43,331
If your form has a subform with detail items, sending the form may not work out for you. It will be far better to send a report rather than the form. The report will expand as necessary if you have more line items than will fit on a single page.
 

Users who are viewing this thread

Top Bottom