Export Record to PDF (1 Viewer)

jfgambit

Kinetic Card Dealer
Local time
Today, 05:18
Joined
Jul 18, 2002
Messages
798
Ok, this is driving me nuts....

Utilizing Access 2007 I have a report that I want to export as a PDF. The report is based on a query that calls for the specific ID number from a form (ID = [Forms]![frmPeerValid]![ID]). Query works fine, and if you open the report it works fine, but when I export the report via a command button on the form, all the records are exported. How do I export to PDF just the record that the individual is on? Code is as follows:

Code:
Private Sub cmdEmail_Click()
'On Error GoTo ErrorHandle

Dim strAttachPath As String
Dim strAttachPath2 As String

'Timestamp the completed validation
If IsNull(Me.ValCompDt) Then
    Me.ValCompDt = Now()
End If

'Save the record
DoCmd.RunCommand acCmdSaveRecord

'Export the report to Word RTF
strAttachPath = "C:\temp\"
strAttachPath2 = "PeerValidation" & format(Date, "yyyymmdd") & ".pdf"

If Dir(strAttachPath & strAttachPath2) <> "" Then
        Kill strAttachPath & strAttachPath2
End If

DoCmd.OutputTo acOutputForm, "frmPeerValid", acFormatPDF, strAttachPath & strAttachPath2, False, , , acExportQualityScreen
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 21:18
Joined
Aug 30, 2003
Messages
36,132
You appear to be exporting the form rather than the report.
 

jfgambit

Kinetic Card Dealer
Local time
Today, 05:18
Joined
Jul 18, 2002
Messages
798
And there we are...another coding snafu

thanks pb...
 

Users who are viewing this thread

Top Bottom