Question

Locked

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

cmdPrintForm_Click_Exit:
Exit Sub

cmdPrintForm_Click_Err:
MsgBox Error$
Resume cmdPrintForm_Click_Exit

End Sub

This conversation is currently closed to new comments.

0 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Share your knowledge
Back to Peripheral Forum
0 total posts (Page 1 of 1)  

Related Forums