Cannot load report filter from DoCmd.OpenReport command

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.
 
D

Duane Hookom

The filter/where clause follows the third comma:
DoCmd.OpenReport StDocName, acViewPreview, , ReportFilter
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top