parameter form creates dynamic filter for report / "no data"

G

Guest

Here's my problem :

I have a report based on a predefined query that is evoked using
DoCmd.OpenReport.

It in turn calls a parameter form using DoCmd.OpenForm. Instead of using
direct query parameters (eg., defining the where statement in the query to
refer to the form data), I create a "filter" in code and then set it in the
parameter form's code :

Reports![rpt_name].FilterOn = True
Reports![rpt_name].Filter = strWhereClause

The form closes and the report runs. However, I suspect that since the
report is technically already open at this point, the filter isn't really
being set, despite having the code report the contents of the two above
properties correctly. (More proof that this is the case is if I run the
same query again, it runs properly and if I ctrl-G and ? for the filter
contents in the "immediate window", it is always the previous query's filter
that is displayed.)

I've obviously got an order problem.

Is it possible to apply a filter at this point or must I change my sequence?
(Don't call the report first, but call the parameter form and have it open
the report w/a filter?)

Thanks.
 
G

Guest

Donna said:
Here's my problem :

I have a report based on a predefined query that is evoked using
DoCmd.OpenReport...

And "Donna" responds :

As is usually the case, after I ask a question, I find out that I screwed up
something simple (in this case, I had opened the report w/a blank filter. I
removed that and now it works. Sigh...)
 

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