473,570 Members | 2,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a recordset based on another recordset

I currently have a solution that requires 2 sub queries, where each of
them is convereted into a crosstab query and then I join the crosstab
queries to a result. I would like to make this more dynamic and
allow for users to filter, and to do so I would like to be able to
create the resulting query all in VBA code.

I can create a recordset of each inital query, but is there a way to
run a query on that, and then subsequently, a query on that returned
recordset.. so i may create the desired recordset for the report?

Nov 13 '05 #1
2 6069
Take a look at Querydef in the Help file. You need to use QueryDef to define
one or both of your queries, one or both of your crosstab queries or the
recordsource query for your report. You then need to create a means (form
with controls and VBA) that the users will use to alter the QueryDef SQL.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
<aj************ *@gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
I currently have a solution that requires 2 sub queries, where each of
them is convereted into a crosstab query and then I join the crosstab
queries to a result. I would like to make this more dynamic and
allow for users to filter, and to do so I would like to be able to
create the resulting query all in VBA code.

I can create a recordset of each inital query, but is there a way to
run a query on that, and then subsequently, a query on that returned
recordset.. so i may create the desired recordset for the report?

Nov 13 '05 #2
This code example applies a filter to a recordset and opens a second
recordset using that filter:

Dim rst1 As DAO.Recordset, rst2 As DAO.Recordset
Dim dbs As DAO.Database
Dim VarValue As Variant
VarValue = "A Value"
Set dbs = CurrentDb
Set rst1 = dbs.OpenRecords et("Queryname" , dbOpenDynaset)
rst1.Filter = "FieldName = " & VarValue
Set rst2 = rst1.OpenRecord set(dbOpenDynas et)

--

Ken Snell
<MS ACCESS MVP>

<aj************ *@gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
I currently have a solution that requires 2 sub queries, where each of
them is convereted into a crosstab query and then I join the crosstab
queries to a result. I would like to make this more dynamic and
allow for users to filter, and to do so I would like to be able to
create the resulting query all in VBA code.

I can create a recordset of each inital query, but is there a way to
run a query on that, and then subsequently, a query on that returned
recordset.. so i may create the desired recordset for the report?

Nov 13 '05 #3

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

Similar topics

4
3079
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use the recordset to loop thru the recordset, update values from the recordset and then update the database by passing parmeters to another stored...
4
11252
by: sci | last post by:
Could someone help me by answering the questions below? What's a cursor? What's difference between Query and View? Is a RecordSet just part of a table? Can it be part of a query of view? If the content in a table changed, is it necessary for a old recordset to renew itself by do "Requery()"? Thanks for your help!
27
6176
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is done? regards, Oscar
2
1690
by: Sreedhar Vankayala | last post by:
Hi, I have a table IV00108wc which contains several thousand records in whcih ITEMNMBR is the primary key. I have a com+ object returning recordset which has ITEMNMBR and another details related. I want to query another table based on Com+ object recordset. Select distinct WebClas1 from IV00108wc where ItemNmbr in (...).
8
3468
by: chrisdavis | last post by:
I'm trying to filter by query or put those values in a distinct query in a where clause in some sort of list that it goes through but NOT at the same time. Example: ROW1 ROW2 ROW3 ROW4 , etc. I want to go to the first row, do a WHERE statement, return the
4
12423
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
5
1597
by: joe donnelly | last post by:
I have a couple of questions about recordsets: 1. When a recordset is summoned by the code where does it actually exist and in what form...is it created in the database (data source location) as a new table that mimics the actual database table and contains the fields and rows asked for in the query? It is somewhat vague as to it's true...
9
35392
ADezii
by: ADezii | last post by:
One question which pops up frequently here at TheScripts is: 'How do I retrieve data from a Recordset once I've created it?' One very efficient, and not that often used approach, is the GetRows() Method of the Recordset Object. This Method varies slightly from DAO to ADO, so for purposes of this discussion, we'll be talking about DAO Recordsets....
2
2772
by: nja2222 | last post by:
I would like to create a page for my clients to login and check for updates on their accounts. Then I would like to create a page where my employees can login and make updates, specifically new file uploads, to the clients accounts. I have seen similar sites everywhere, such as bank websites, USPS site, et cetera. What is required to accomplish...
0
7726
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7636
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...
0
7948
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7700
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...
0
8000
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...
0
3671
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1238
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
971
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...

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.