Ryan,
I see what you're getting at. I don't know of a way. The only thing I can
think of would be to control the user opening the query in that fashion in
the first place. Usually, the user shouldn't have access to the main
database window where they could just click on a query and open it. If you
used a form to allow them to open the query, you could put the parameter
prompts on the form (and therefore capture them) and not let them click the
button to open the query until the parameters had been filled in.
That being said, if you open a Report based on a query that prompts for
parameters, you can use the "names" of the parameters in the report and it
will pick up the values that were entered. However, again, the user didn't
directly open the query, the query was opened by opening the report.
--
Wayne Morgan
Microsoft Access MVP
"Ryan Hubbard" <ry******@yahoo.com> wrote in message
news:41**********************@news.newsgroups.ws.. .
Please bare with me here for a sec. I thank you for all your help but I
know queries don't have scripts I'm actually a very experienced vba
programmer. But the script will be run independently of the queries. I
also know how to open a query but please assume there is no way around
the situation, which is there are open query windows already which you
need to extract the data from. You then run a vb script, can the vb
script access the query data which is already open. An example of when
you can't just open a record set for a query is if it has parameters.
Parameters which have already been given when the individual has run the
query for the query window. Open the record set via the OpenRecordset
does not open the record set from the open query instead runs the query
again and will expect parameters. So is there a way to access the
results for a query that is already open in a window?