Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping through a 2nd recordset

Status
Not open for further replies.

M8KWR

Programmer
Aug 18, 2004
864
GB
Hi,

I have a form with a query applied to it, i am looping for the records brought back, but i also need to loop through some more sql, when a condition is hit in the first loop.

What is the best way of doing what i require.

Many thanks for any help in advance.
 
Depends really, what are you looping the second resultset for? Are you looking for a value (in which case a second recordset is unnecessary) or are you performing some action based on the values in the second resultset?

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
I am looping the first set for get email attachments, but if a value in the first loop = x, then i need to query that against another table, to create even more attachments for an email

If that makes sense.

I was thinking a 2nd recordset would be best.. but unsure if there was another way.
 
If the second query is returning multiple results that you need (i.e. you will need more than one value from more than one row) then I would agree that a second recordset would be my choice of route.

Cheers

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top