468,140 Members | 1,423 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

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 5652
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******@pcdatasheet.com
www.pcdatasheet.com
<aj*************@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.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.OpenRecordset("Queryname", dbOpenDynaset)
rst1.Filter = "FieldName = " & VarValue
Set rst2 = rst1.OpenRecordset(dbOpenDynaset)

--

Ken Snell
<MS ACCESS MVP>

<aj*************@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.