By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

Listing a "Where" clause from OPENREPORT in a Report Control

P: n/a
Can someonw pls tell me how to reference the Where clause made by the
VBA statement

DoCmd.OPENREPORT "Report",acviewpreview,,where

as a control within the Report itself?

Thanks.

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The WhereCondition of the OpenReport action turns up as the Filter property
of the report.

You could therefore display it on the report with a text box that has
Control Source of:
=[Report].[Filter]

Unfortunately, the report's Filter property may contain a left over value
from a previous filter, even if no filter is applied. You should get around
this by testing the report's FilterOn property, but there is a bug in Access
and the FilterOn property is not maintained reliably for reports. (FilterOn
is always set correctly for forms, but not for reports.)

In Access 2002 and later, you could repeat the WhereCondition in the
OpenArgs argument of OpenReport, i.e.:
DoCmd.OpenReport "MyReport",acviewpreview, ,strWhere, , strWhere
and then display it on the report with:
=[Report].[OpenArgs]

In older versions, you could set a public string variable (one declared in
the General Declarations section of a standard module) to the
WhereCondition, and use the Report Header's Format event to read the
variable, assign its value to an unbound text box, and then clear the
string.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Tom Louchbaum" <tw*@uwm.edu> wrote in message
news:41**************@uwm.edu...
Can someonw pls tell me how to reference the Where clause made by the
VBA statement

DoCmd.OPENREPORT "Report",acviewpreview,,where

as a control within the Report itself?

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.