访问:如何生成记录集的报告? [英] Access:How can I generate a report of a recordset?

查看:56
本文介绍了访问:如何生成记录集的报告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用访问记录集中的数据(而不是查询或表)来生成报告.我有记录集的更新,该记录集也必须显示在报告中.

How can I generate a report in access with the data from a recordset (instead of a query or table). I have updates to the recordset that also must be shown in the report.

推荐答案

来自访问网络可以使用记录集的名称"属性.生成的代码如下所示:

From Access Web you can use the "name" property of a recordset. You resulting code would look something like this:

在报告中

Private Sub Report_Open(Cancel As Integer)
    Me.RecordSource = gMyRecordSet.Name
End Sub

在调用对象(模块,表单等)中

Public gMyRecordSet As Recordset
'...
Public Sub callMyReport()
    '...
    Set gMyRecordSet = CurrentDb.OpenRecordset("Select * " & _
                                               "from foo " & _
                                               "where bar='yaddah'")
    DoCmd.OpenReport "myReport", acViewPreview  
    '...
    gMyRecordSet.Close  
    Set gMyRecordSet = Nothing
    '...
End Sub

这篇关于访问:如何生成记录集的报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆