krissco said:
Even if you meant to open the report in preview mode, you
can not "push" values into a report. However, reports can
"pull" values from all kinds of places.
Maybe it's just semantics, but I disagree. You can load your filter
string with all sorts of information you wish to "push" into a report
and parse it as needed. One way I have used this in the past is by
appending an expression that always evaluates as TRUE to the filter
string. . . Ok. That's confusing. Here is what I mean:
strFilter = "somefieldName = someLegitimateFilter and 'Foo' = 'Foo'"
docmd.openreport blah, blah, blah, blah, strFilter []
Then in the report:
if me.Filter like "*Foo*" then . . .
Thats what I mean by "pushing" information into a report.
You are probably familiar with most of this, but I thought a
quick review might help others follow this discussion.
I think most folks call that "passing" arguments to a
form/report. The report then takes the passed values and
sets its own properties. With passed arguments, the report
does not care who called it and the caller does not need to
"know" anything about the report. Since A2K, the standard
way to pass an argument string to a report is to use the
OpenReport method's OpenArgs argument.
"Pushing" is when the caller sets the report's properties
directly from VBA code outside the report. If this were
effective, it would alleviate the need for the report to
know who called it, but the calling code would be required
to know a lot about the report.
"Pulling" is when the report retrieves values directly from
the caller and sets its own properties. In this case the
report must know who called it and about how the caller
arranged the values.
A "common/global area" is a publicly available storage space
where the caller sets the values and the report retrieves
them. This technique is kind of a neutralized push and
pull. It avoids the problems of pushing and pulling, but
there are other serious issues with using common storage.