Issue:
After installing Office 2010 SP1, when specifying a WhereCondition parameter in an OpenReport method AND setting the target report's record source in the report's open event, the WhereCondition parameter is not applied. The problem will manifest even in cases where the recordsource property is not changing from its original setting.
Workaround:
Microsoft is aware of the issue and it is currently being investigated. In order to work around the problem, you can try the following:
· Filter the report records by passing writing a valid report filter statement and passing this to the report using OpenArgs. On the report's open event, set the report's Filter property to OpenArgs, then set the report's FilterOn property to true.
· Pass a WHERE clause to the report using OpenArgs. On the report's open event, incorporate the OpenArgs value into a SQL statement and set the report's recordsource property to this SQL statement
· If it isn't necessary to change the recordsource of the report, eliminate the code from the report open event where the recordsource is being set.
· Create a copy of the target report, base it on a different recordsource object, remove the code from the report's open event, and add code to the object from which the report is being opened that logically selects which report to open.
Kirk Beller
Microsoft Online Community Support