Cannot load report filter from DoCmd.OpenReport command

  • Thread starter Thread starter RobGMiller
  • Start date Start date
R

RobGMiller

Access 2003:

Try to open a report to print with the following:

ReportFilter = "PoId = " & Me!PoID & ""
StDocName = "PurchaseOrder"
DoCmd.OpenReport StDocName, acViewPreview, ReportFilter, ,
acWindowNormal

Report.OnActivate:

MsgBox Me.Filter shows it to be empty.


I've tried filter on = yes and no

I've tried to set the filter from the calling form after the report is
open using the following.

What did work is to open the report in design mode, set the
recordsource, save it and then reopen in normal preview mode.

I'm not sure if there are any implications of opening a report that
way. Its always disconcerting to have to use workarounds for things
that should work easily.

I'd like to discover why this filter cannot be loaded if I can.
 
The filter/where clause follows the third comma:
DoCmd.OpenReport StDocName, acViewPreview, , ReportFilter
 
RobGMiller said:
Access 2003:

Try to open a report to print with the following:

ReportFilter = "PoId = " & Me!PoID & ""
StDocName = "PurchaseOrder"
DoCmd.OpenReport StDocName, acViewPreview, ReportFilter, ,
acWindowNormal

Report.OnActivate:

MsgBox Me.Filter shows it to be empty.


I've tried filter on = yes and no

I've tried to set the filter from the calling form after the report is
open using the following.

What did work is to open the report in design mode, set the
recordsource, save it and then reopen in normal preview mode.


You are using the wrong argument. The Filter argument is
supposed to be a query, but I have never found a use for it.
What you are trying to do is use the WhereCondition
argument:

DoCmd.OpenReport StDocName, acViewPreview, , ReportFilter
 
Back
Top