I'm having trouble with my print button code on my form. I want to print directly to pdf and save in a particular folder. The problem is it is printing ALL the records instead of the focus record. I would greatly appreciate if someone could tell me where I'm going wrong...below is the code
Code:
Private Sub cmdPrint3_Click()
Dim FileName As String
Dim FilePath As String
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[CVINo] = " & Me.[CVINo]
End If
FileName = "The Sands CVI No" & Me.CVINo
FilePath = "C:\Users\reva.harrison\" & FileName & ".pdf"
DoCmd.OutputTo acOutputReport, "rptCVI", acFormatPDF, FilePath
MsgBox "CVI has been successfully created", vbInformation, "Create CVI"
End Sub