Print Form with single record

H

Hank

I have Access 2003. A command button on a payment form has the following
event procedure:

Private Sub PrintReceipt_Click()
On Error GoTo Err_PrintReceipt_Click

Dim stDocName As String
Dim MyForm As Form

stDocName = "PmtReceipt"
Set MyForm = Screen.ActiveForm
DoCmd.SelectObject acForm, stDocName, True
DoCmd.PrintOut acSelection = PmtID = Me!PmtID
DoCmd.SelectObject acForm, MyForm.Name, False

Exit_PrintReceipt_Click:
Exit Sub

Err_PrintReceipt_Click:
MsgBox Err.Description
Resume Exit_PrintReceipt_Click

End Sub

On a payment form that shows all payments a client has made.
I need to be able to pick a single payment (PmtID) and print a receipt for
just that payment. Right now it prints a receipt form for every payment the
client has made.

Most of this code was generated by the command button wizard. I only added
....acSelection = PmtID = Me!PmtID ...Where am I going wrong?

Thanks
Hank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top