Results 1 to 2 of 2
  1. #1
    Stretholox is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2014
    Posts
    24

    Save only the current record of a form as a PDF

    Hello,

    I'm trying to create a macro that saves the current "visible" record of a form as a PDF. I'm not sure how to do this. I looked online and the best I could find was the following code.
    Private Sub SaveToPDF(Totals As String)
    On Error GoTo SaveToPDF_Err
    'Totals = name of form the function was called from
    'DestPath = Destination path for PDF file
    Dim DestPath As String
    'DestFile = Destination file name for PDF file
    Dim DestFile As String
    'ShowPdf = launch acrobat and display saved PDF file
    Dim ShowPdf As Boolean
    'Saves the file to specific folder
    DestPath = "\\AHCDFS.AHC.UFL.EDU\FILES\DN\PERSONAL\stephenpaol ini\Desktop\Send Remediation"
    'Formats the file name


    DestFile = "\TabulaRasa"
    ShowPdf = False
    'DoCmd.OutputTo acOutputForm, , acFormatPDF "PDFFormat(*.pdf)", DestPath & DestFile & ".pdf", ShowPdf, "", 0, acExportQualityPrint
    Dim strDestFile As String
    strdesfile = DestPath & DestFile & ".pdf"
    DoCmd.OutputTo acOutputForm, Totals, acFormatPDF, strdesfile, False
    SaveToPDF_Exit:
    Exit Sub
    SaveToPDF_Err:
    Resume SaveToPDF_Exit
    End Sub

    Unfortunately this code totally breaks my form when used. There is also no evidence that this is working either. I'm trying to use this function, in combination with an email macro, to be able to email a specific record of a form. For more context I'm trying to allow the user to email a student with certain qualities a copy of their record in the form. Luckily I don't have to email en masse so I thought I'd just continue to use the same file destination and over-write it if the user wants to send a different record as well.

    I hope I am not being too confusing. I appreciate any help you can give.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'm assuming you're using a bound, continuous form here, am I correct?

    A BOUND form is one that's tied directly to a query or a table

    Here's an example (one I'd recommend) in doing it with a report, rather than trying to export the form as a PDF:

    http://www.techrepublic.com/article/...-in-form-view/

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Populate form with current record
    By drew17 in forum Forms
    Replies: 1
    Last Post: 06-30-2014, 11:23 AM
  2. Form loads with no current record
    By ts_hunter in forum Forms
    Replies: 11
    Last Post: 01-15-2014, 10:33 AM
  3. Add Record from Current Form to a Table
    By Smtz in forum Access
    Replies: 1
    Last Post: 08-26-2013, 03:49 PM
  4. Replies: 3
    Last Post: 10-08-2012, 08:40 AM
  5. Replies: 11
    Last Post: 03-29-2012, 11:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums