Programmatically accesing query results

S

shithappens

This may be a basic thing to do but im stumped ....so please help

I wish to run a query and then cycle through the results and write
just one field into a text file in cvs format

To date i have used recordsets to cycle data but with the required
items needing to be found across several linked tables based on what
is selected in a combo box by the user a query seems the easiest way.
(I have this functionality already)

QUESTION How do i access the query results much like a recordset so
that i can cycle through the results ????
 
P

pietlinden

This may be a basic thing to do but im stumped ....so please help

I wish to run a query and then cycle through the results and write
just one field into a text file in cvs format

To date i have used recordsets to cycle data but with the required
items needing to be found across several linked tables based on what
is selected in a combo box by the user a query seems the easiest way.
(I have this functionality already)

QUESTION How do i access the query results much like a recordset so
that i can cycle through the results ????

Simple. Open your recordset based on a querydef (query) or stored
procedure (if you're using ADO). Check out QueryDef.OpenRecordset in
the help.

something like
dim qdf as dao.querydef
set qdf=dbengine(0)(0).openquerydef("Queryname")
set rs = qdf.openrecordset
then you can loop through the recordset as you are accustomed to doing.
 
G

ged

Simple. Open your recordset based on a querydef (query) or stored
procedure (if you're using ADO). Check out QueryDef.OpenRecordset in
the help.

something like
dim qdf as dao.querydef
set qdf=dbengine(0)(0).openquerydef("Queryname")
set rs = qdf.openrecordset
then you can loop through the recordset as you are accustomed to doing.

Cheers man your my Dady!!!!!!

just joking but hell thanks for that
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top