Results 1 to 2 of 2
  1. #1
    REBBROWN is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2010
    Posts
    14

    specific record output to .pdf


    Hopefully someone can help me figure this one out.
    I have one table with almost 2K records in it.
    I want the user to be able to print a specific record.

    In an Access DB I found I was able to copy the code and get it to work.
    I have included the code below.
    What I really need to be able to do is not just print a specific record, but to be able to output it in .pdf


    so that it can be either printed or more importantly, saved and emailed as an attachment.

    I have tried to write a macro that will output to .pdf and can choose the specific report, in this case the report name; “VEH_RECD’ but it will output 2K records in .pdf, not just the one specific one that is being viewed in the form in that time.
    Any ideas?

    Private Sub cmdPrintPreview_Click()
    Dim strReportName As String
    Dim strCriteria As String
    If NewRecord Then
    MsgBox "This record contains no data. Please select a record to print or Save this record." _
    , vbInformation, "Invalid Action"

    Exit Sub
    Else
    strReportName = "rptSalespersonContact"
    strCriteria = "[lngSalespersonID]= " & Me![lngSalespersonID]
    'strCriteria = "[lngSalespersonID]='" & Me![lngSalespersonID] & "'"

    DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

    End If
    End Sub

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    One approach would be to make a report (of the single record ...).

    Then up in the ribbon one can simply select the pdf export option.

    Not sure if this semi manual approach is what you want or not - one benefit is that the user looks at the report (hopefully) before turning into a pdf so that if for whatever reason the data is not correct they can react accordingly.

    Hope this helps.

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

Similar Threads

  1. Code to pull in data from a specific record
    By jdunn36 in forum Access
    Replies: 1
    Last Post: 09-20-2010, 11:54 AM
  2. Text Box to show specific record
    By chu3w in forum Forms
    Replies: 1
    Last Post: 04-01-2010, 12:23 PM
  3. specific record
    By thewabit in forum Access
    Replies: 8
    Last Post: 02-17-2010, 11:32 PM
  4. Print a specific record report from a form
    By cynthiacorley in forum Reports
    Replies: 27
    Last Post: 02-08-2010, 06:34 AM
  5. How to output only current record in query
    By mslieder in forum Access
    Replies: 0
    Last Post: 01-20-2006, 05:48 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