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.
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