Access - How to print current Form

By JodyLynn ·
Hi all,

I have a form which I have added a print button to. I want to print the current record the form is displaying. I have the following code in the "on click" event for the Print command button. txtProjectsKey is the name for the text box that displays the key field for the current record. Right now I keep getting a message that the RunCommand action was cancelled. Does anyone know what I am doing wrong here?

Private Sub cmdPrintForm_Click()
On Error GoTo cmdPrintForm_Click_Err

DoCmd.GoToControl "txtProjectsKey"
DoCmd.RunCommand asCmdFilterBySelection
' Print only current page
DoCmd.PrintOut acSelection, 1, 1, acHigh, 1, True

Exit Sub

MsgBox Error$
Resume cmdPrintForm_Click_Exit

End Sub

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums