How do I create an event procedure to save to a PDF file?
Posted on 2013-12-12
I would like to create a button on my form to save a file as PDF. Below I have code that enables me to create the focus on the current record then open it in print preview. I would like to have the report open as a PDF. When I create a button, I can create a macro, but need it to focus on the current record. How do I do this?
Private Sub print_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "Daily Job Summary", acViewPreview, , strWhere
Thank you for your help :)