标题: 如何令一条记录输入完毕后,然后打印的时候可以在报表里打印当前记录? [打印本页] 作者: 小幽 时间: 2002-12-4 18:36 标题: 如何令一条记录输入完毕后,然后打印的时候可以在报表里打印当前记录? 如何令一条记录输入完毕后,然后打印的时候可以在报表里打印当前记录?作者: cattjiu 时间: 2002-12-4 19:35
例子见northwind.mdb的发票打印例子。
Sub PrintInvoice_Click()
' This code created by Command Button Wizard.
On Error GoTo Err_PrintInvoice_Click
Dim strDocName As String
strDocName = "Invoice"
' Print Invoice report, using Invoices Filter query to print
' invoice for current order.
DoCmd.OpenReport strDocName, acViewNormal, [B]"Invoices Filter"[/B]'筛选查询
Exit_PrintInvoice_Click:
Exit Sub
Err_PrintInvoice_Click:
' If action was cancelled by the user, don't display an error message.
Const conErrDoCmdCancelled = 2501
If (Err = conErrDoCmdCancelled) Then
Resume Exit_PrintInvoice_Click
Else
MsgBox Err.Description
Resume Exit_PrintInvoice_Click
End If
End Sub
Invoices Filter筛选查询:
SELECT DISTINCTROW Invoices.*
FROM Invoices
WHERE (((Invoices.OrderID)=[Forms]![Orders]![OrderID]));