Results 1 to 2 of 2

Export single record from a form to PDF

  1. #1
    GraemeG is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    152

    Export single record from a form to PDF

    Hello.

    I am having trouble exporting single records from a form to pdf.
    I have the following code so far. but it gives:

    Run time error 3464
    Data type mismatch in criteria expression.

    Debug highlights:
    Me.RecordSource = "Select * From Propertyextract Where [propref] = " & _
    ![propref]

    Any help appreciated.

    Code:
    Private Sub cmdExportPDF_Click()
     Dim MyDB As DAO.Database
        Dim MyRS As DAO.Recordset
        Dim strSQL As String
     
     
        strSQL = "Select Propertyextract.[propref] From Propertyextract;"
     
        Set MyDB = CurrentDb
        Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenForwardOnly)
     
        With MyRS
          Do While Not MyRS.EOF
            Me.RecordSource = "Select * From Propertyextract Where [propref] = " & _
                               ![propref]
            DoCmd.OutputTo acOutputForm, "FrmPropertyAttributes", acFormatPDF, "" & ![propref] & ".pdf"
             .MoveNext
          Loop
        End With
     
     
        MyRS.Close
        Set MyRS = Nothing
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    11,897
    What is the data type of propref? If text, the value needs to be surrounded by single quotes.
    Paul (wino moderator)
    MS Access MVP
    www.BaldyWeb.com

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

Similar Threads

  1. Single Record Update Query from a Form
    By Steven.Allman in forum Access
    Replies: 0
    Last Post: 03-30-2011, 08:34 AM
  2. Print Single Record
    By stattech in forum Reports
    Replies: 5
    Last Post: 10-05-2010, 02:38 AM
  3. Replies: 0
    Last Post: 05-13-2010, 04:18 AM
  4. Export single records to new Word Document
    By karmaimages in forum Import/Export Data
    Replies: 0
    Last Post: 11-19-2009, 01:37 PM
  5. Adding a single record
    By kfoyil in forum Forms
    Replies: 2
    Last Post: 11-22-2006, 07:12 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
  •  
Tech Forums: Microsoft Office Forums