|
Printing an Invoice |
Introduction
You probably know that, if you create a button on a form and call a report, when you click the button, all records on the report would be printed. On a data entry form, you may want to print only the report related to the record you are viewing. This is equivalent to printing an invoice. Although this involves writing code, only a very slight modification is necessary to implement this behavior. It consists of setting the criteria of the DoCmd.OpenReport method.
Practical Learning: Printing an Invoice

Private Sub cmdPreviewInvoice_Click()
On Error GoTo Err_cmdPreviewInvoice_Click
Dim stDocName As String
stDocName = "WorkOrders"
DoCmd.OpenReport stDocName, acPreview, , "WorkOrderID = " & WorkOrderID
Exit_cmdPreviewInvoice_Click:
Exit Sub
Err_cmdPreviewInvoice_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewInvoice_Click
End Sub|
|
||
| Home | Copyright © 2004-2019, FunctionX | FunctionX |
|
|
||