473,416 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 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 10569
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 SELECT * FROM BookInfo WHERE BookName LIKE...
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 ID. The parent form (frmMainForm) displays the...
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 records, and related with an index value. I create...
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 SQL string (say strSQL) is built up with the...
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 "qselRosterEmailList" into one string (strEmails). I...
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 of the companies in the database (found using the...
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 data on the screen in table form. All works fine. ...
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 selecing a query criteria and then pressing the button...
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 of the do loop to begin iterating through the set...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.