Report To PDF

  • Thread starter cokeitis via AccessMonster.com
  • Start date
C

cokeitis via AccessMonster.com

Hi there,

I would like to create a pdf file for my invoice using a combination of the
company name and invoice number. I would like to be able to preview the
invoice first, then save it and when it's saved the invoice would look
something like this: fakecompany-LPI02.

The code below is what I'm currently using to preview the invoice. I then
would select CUTEpdf Writer from my list of printers and save the file
manually.

If someone have a sample code I would really appreciate it as I have little
clue how to get this done. I've searched but haven't found one that I feel I
can tackle. Thanks in advance.

Private Sub cmdPrintInvoice_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "rptInvoice"
strFilter = "InvoiceNo = Forms!frmInvoice!InvoiceNo"
'Use this if you are sending report directly to printer
'DoCmd.OpenReport "rptInvoice", , , strFilter
'Use this if you are previewing report before printing
DoCmd.OpenReport "rptInvoice", acViewPreview, , strFilter
End Sub
 
A

Allen Browne

What version of Access is this?

If you use Access 2007, you can download the PDF add-in from:
http://www.microsoft.com/downloads/...11-3E7E-4AE6-B059-A2E79ED87041&displaylang=en

You can then use it like this:
strFile = Environ("HOMEDRIVE") & Environ("HOMEPATH") & "\Desktop\Invoice" &
Me.InvoiceID & ".pdf"
DoCmd.OpenReport strDoc, acViewPreview, , "InvoiceID = " & Me.InvoiceID
DoCmd.OutputTo acOutputReport, strDoc, acFormatPDF, strFile, True

If you use Access 2002 or 2003, you could set the Printer object to your
CUTEpdf Writer before you open the report.

Another alternative is Stephen Leban's PDF printer:
http://www.lebans.com/reporttopdf.htm

Hopefully there's a useful direction there for you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top