473,729 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10597
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.goo gle.com...
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.OpenR ecordset("qryMy Query", 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
3733
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 '*cobol*' When I use this query to build recordset I get empty recordSet back when the BookInfo table has entries that qualify for this criteria. To
25
10256
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 data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
22
2888
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 a table and add the index value and a value/s from each recordset in turn, into a temporary table, which I used to create a report. I created this with DAO objects, and it worked fine. I use iteration, and the ..movenext command to get the next...
7
8501
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 criteria. Then a list box RowSource property is set to this strSQL, to display the results of the search. StrSQL is a global variable within this Form's code module, i.e. in the class module.
19
59971
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 can get one record's result by using the DLookup fuction, of course, but I want to get every record's value. To do this, I believe I need to build a recordset, but I do not know how. I've read about doing it using DAO in Access 97, but I am...
13
3477
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 query: QryICTMassDistribution3) , I then use a form and the code below to create a new record in the corrispondence table to show what corrispondence has been sent to various companies.
11
2736
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. I wish to evaluate one field in the record and depending on the value in that field I wish to change the colour of the line in the table. As
4
2509
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 to take care recoredset from access to excel. i have checked the code in any ways its working fine but when i use the combo box criteria forms!formname!combobox in the query the code breaks down at rst.open a """""""""""gives...
14
1662
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 the EOF value is already "true" so all my code is skipped. I check the local window and tested the sql statement in access by creating a blank query and pasting the sql into the query and running it. It works fine this is the sql statment being...
0
8766
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9291
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9217
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9158
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8160
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6026
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2698
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.