Can I view a reports Recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm trying to view the data that a report is using. This report was opened
with the OpenReport method with the wherecondition parameter set. Now I want
to view the exact data the report is using. Does it not have a recordset like
a form does? I really need the conditioned data. Alternatively, is there a
way I can access the value of the wherecondition parameter specified in the
OpenReport method?

TIA,
Eric
 
Put the report into design view and in the upper left corner of the report
where the measure rulers up the left side and along the top come
together....right click on that square.....

one of the options will be properties (at the bottom of the list); select
properties.

you will see record set as the first in the properties list. this is what
you want. if the record set is a table - then just close all this and go to
the tables area and look at the table.

if the record set is a query there will be a ... box if you select
the ... box it will open up the query in design view. press the ! icon in
red at the top and it will run the query and produce the results in table
view.
 
Actually when the report is in preview, go to the design view and find the
Filter property. Copy this to the clip board. Then open the record source
property in the SQL designer. You can then view the SQL of the record source
and paste the Filter property into the Where clause. This might take some
fix-up.
 
Hi,

Thanks for the reply. But this is not what I'm asking. I know what the
recordsource is, but I want to know if there is a way to access the recordset
during runtime.

Example:

I run a report
DoCmd.OpenReport "some_report", acPreview,, "wherecondition"

So MS Access, using the wherecondition provided by the OpenReport method,
generates a modified recordset which is filtered by the criteria provided. I
want access to this modified recordset.

Is it possible?

TIA,
Eric
 
Hi,

Thanks for the reply. But this is not what I'm asking. I know what the
recordsource is, but I want to know if there is a way to access the recordset
during runtime.

Example:

I run a report
DoCmd.OpenReport "some_report", acPreview,, "wherecondition"

So MS Access, using the wherecondition provided by the OpenReport method,
generates a modified recordset which is filtered by the criteria provided. I
want access to this modified recordset.

Is it possible?

TIA,
Eric
 
Yes you can.

When you have opened the report in preview mode y ou can access all of its
properties and use them for your additional purpose.

Should be somthing like this example (following your example below):
----------------------------------
Dim strSql as string

strSql = "SELECT * FROM " & reports(some_report).recordsource & _
" WHERE " & reports(some_report).filter
docmd.openquery strSql
----------------------------------
How you address your report depends on where you put your code.
You should also, maybe, do some testing if there is any value in the
".Filter" property of the report - otherwise the sql might fail

Einar



"Eric D." skrev:
 
I told you the wherecondition is in the Filter property of the report. You
can get this in code behind the report using Me.Filter. You should be able
to combine this property value with the report's record source property to
get a fully identified recordset.
 
Back
Top