ADODB记录的访问报告记录源 [英] ADODB RecordSet as Access Report RecordSource
问题描述
我有一个简单的表单,查询和报表在Access 2003中我必须处理从查询使用VBA的结果,一个记录集,然后将它传递给报告的记录源。
I have a simple form, a query and a report in Access 2003. I have to manipulate the results from the query in a recordset using VBA and then pass it on to the report as its RecordSource.
如果我宣布了记录的记录集,并使用其名称属性的报告则是工作的记录源。但是,因为我需要编辑的记录,我虽然这将是更容易使用的ADODB记录如下。
If I declare the recordset as RecordSet and use its Name property as the RecordSource of the report then it is working. However, because I need to edit the recordset, I though it would be easier to use an ADODB RecordSet as below.
设置的记录被声明为昏暗RS作为ADODB.RecordSet
在全局模块。
的code剩下的就是;
The records set is declared as Dim rs As ADODB.RecordSet
in a global module.
The rest of the code is;
Dim db As Database
Set db = CurrentDb
Dim con As ADODB.Connection
Set con = CurrentProject.Connection
Set rs = New ADODB.Recordset
Set rs.ActiveConnection = con
rs.Source = "Select * from XXX"
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open
'manipulate rs here....'
我用来打发报告myReport.RecordSource = rs.Name的记录源。 但ADODB不具有名称属性。
I used to pass the RecordSource of the report as myReport.RecordSource = rs.Name. But the ADODB doesn't have a Name property.
我怎样才能通过这个记录报告作为其记录源?
How can I pass this recordset to the report as its RecordSource?
感谢
推荐答案
您不能绑定到一个ADO记录集了一份报告,一个MDB,只能在ADP:的 http://support.microsoft.com/?id=287437
You cannot bind a report to an ADO recordset in an mdb, only in an adp: http://support.microsoft.com/?id=287437
这篇关于ADODB记录的访问报告记录源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!