472,328 Members | 1,056 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Get recordset from an open query window

Is it possible to get the recordset from an open query window? So you
run the query. The window is open. Can vba retrieve this data?
Nov 13 '05 #1
5 10478
It is possible to create a recordset based on the query, but if the records
have changed since you opened the window then the recordset would reflect
those changes. What are you trying to do by doing this?

--
Wayne Morgan
Microsoft Access MVP
"Ryan Hubbard" <ry******@yahoo.com> wrote in message
news:ab**************************@posting.google.c om...
Is it possible to get the recordset from an open query window? So you
run the query. The window is open. Can vba retrieve this data?

Nov 13 '05 #2


I'm writing a script for a friend and he wants to be able to run queries
then from the open queries run a vb script that will manipulate data
only on open queries. I know there may be better ways but thats what he
wants. I don't care about wether or not the data has changed I just
want to be able to get the data from the open window. Any thoughts on
how I would go about doing this? Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #3
Queries don't have scripts. Forms are designed for doing this. Create a form
using the query as its Record Source. You can then refer to the form's
recordset in the event procedures for the form and/or its controls.

Me.Recordset, etc.

To simply open a recordset in code using DAO:
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("qryMyQuery", dbOpenDynaset)

--
Wayne Morgan
Microsoft Access MVP
"Ryan Hubbard" <ry******@yahoo.com> wrote in message
news:41**********************@news.newsgroups.ws.. .


I'm writing a script for a friend and he wants to be able to run queries
then from the open queries run a vb script that will manipulate data
only on open queries. I know there may be better ways but thats what he
wants. I don't care about wether or not the data has changed I just
want to be able to get the data from the open window. Any thoughts on
how I would go about doing this? Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #4


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?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
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?

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: HKM | last post by:
Hello, I have a query engine that builds the SQL Query to obtain the recordSet. Following is an Exmaple Query that my QueryBuilder outputted ...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum...
22
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of...
7
by: Jean | last post by:
Hello, I have a form that performs a search, according to criteria that a user enters into the text boxes. When the user clicks on „Search", a...
19
by: bdt513 | last post by:
I am trying to extract the values from a query using VBA. Specifically, I want to concatenate all the values of the "rosEmail" field from query...
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset...
11
by: altreed | last post by:
Hi, I am new to ASP, HTML and iis. I have my asp code working so that I can retrieve my desired record from the database. I can place the...
4
by: torontolancer | last post by:
Hi there how r u .I would really appriciate ur concern regarding checking out this code. its beind a command button and i am have a combo box...
14
by: techbuddha | last post by:
Hey everyone many thanks for help with my last post. This one I hope is an easy one for folks here I am opened a record set and at the begining...
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.