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

How to set query parameters from VBA

P: n/a
I am running Access 2002. I have some reports I would like to be able to
run from VBA or interactively. The reports use queries with parameters.
When the user runs the report, the parameter prompts for the query are
displayed, and the user fills them in. What I would like to do is set
those parameter values from VBA when running the reports. Is there a way
to do that?

Thanks in advance,

amorphous
Aug 16 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I would think it would be easier to remove the parameters from the
queries you're using and then just pass a valid Where clause in the
open event of the report. Then you can build whatever filters you want
and reuse the report more easily. bit that's just my opinion.

Aug 16 '06 #2

P: n/a
On 16 Aug 2006 03:16:56 GMT, amorphous999 <jf**********@MAPSON.com>
wrote:

Not entirely sure what you mean, but I have been experimenting with
Criteria forms launched as Modal forms in the Report_Open event; just
in time for setting Me.RecordSource.

-Tom.

>I am running Access 2002. I have some reports I would like to be able to
run from VBA or interactively. The reports use queries with parameters.
When the user runs the report, the parameter prompts for the query are
displayed, and the user fills them in. What I would like to do is set
those parameter values from VBA when running the reports. Is there a way
to do that?

Thanks in advance,

amorphous
Aug 16 '06 #3

P: n/a
In article <Xn**********************************@216.165.192. 91>,
jf**********@MAPSON.com says...
I am running Access 2002. I have some reports I would like to be able to
run from VBA or interactively. The reports use queries with parameters.
When the user runs the report, the parameter prompts for the query are
displayed, and the user fills them in. What I would like to do is set
those parameter values from VBA when running the reports. Is there a way
to do that?

Thanks in advance,

amorphous
You might google groups for: Ken Sheridan parameter query every report

It may be of some help.
Aug 16 '06 #4

P: n/a
pi********@hotmail.com wrote in news:1155700842.369166.142880
@m73g2000cwd.googlegroups.com:
I would think it would be easier to remove the parameters from the
queries you're using and then just pass a valid Where clause in the
open event of the report. Then you can build whatever filters you want
and reuse the report more easily. bit that's just my opinion.
basically, i can't do that. the problem is that the report pulls and
groups data from two sources using 2 different queries (call them Qry1 and
Qry2). A third query QryR, joins the results of Qry1 and Qry2 together and
is the recordsource of the report. The filtering criteria I currently
specify in the parameters has to be applied to Qry1 and Qry2 rather than
QryR. That's why I'd like to set query parameters from VBA code.

amorphous
Aug 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.