Office中国论坛/Access中国论坛

标题: 如何令一条记录输入完毕后,然后打印的时候可以在报表里打印当前记录? [打印本页]

作者: 小幽    时间: 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]));


作者: 小幽    时间: 2002-12-5 19:26
十分感谢
作者: Flyingwing    时间: 2002-12-7 09:09
谢谢!
比我原先的方法高明多了!
作者: elong    时间: 2009-8-12 12:59
不错




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3