[AccessD] What is the best way to grab fields from a report detail line so that they can be accessed in VBA?

Brad Marks BradM at blackforestltd.com
Mon Jul 4 13:53:23 CDT 2011


All,

I want to grab the value of fields from report detail lines.

Here is the method that I finally got to work.

I open the report with a line like this...

DoCmd.OpenReport "Report1", acViewPreview, "", "", acNormal

I then grab the fields in the "On Print" Event

This works, but I would like to know if this is the best method to do
this.

~ ~ ~ ~

There rest of the story...

Here is what I am trying to accomplish.

I have a number of Access 2007 reports that employ "dynamic filters" via
the use of "Report View" and the "Where Condition" when the report is
opened.  In other words, the filters are applied at the report level and
not at the underlying query level.  (There are buttons on the reports
which open up a small form that is used to collect "filter info" and
then re-open the report with the appropriate "Where Condition" based on
the "filter info")

Now there is a need to export the report data to Excel.  Because of the
complex nature of the reports, they do not Export very nicely to Excel
(I have tried several approaches). 

I know that I could easily export from the underlying queries to Excel,
but this type of export would not take into account the filters that are
applied at the report level.

Therefore, to export the exact data on the reports to Excel, I have
started to experiment with grabbing the data from the report as it is
being built.  This is not ideal, but I can't seem to find a better
method.

Maybe others have run into this issue and have a better approach.

Thanks for your assistance.

Brad




More information about the AccessD mailing list