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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query problem

Status
Not open for further replies.

kloner

Programmer
May 15, 2000
79
0
0
AU
Hi all,

When I have a query and am looping through it to find the groupname for a username, I want to somehow 'Break' the query for that user. For example looking at the data below if I am searching for 'members' I don't want the query to continue once 'members' has been found. I want it to stop at the first record where we find 'members' and not continue. How would I do this?


DB Example....
username groupname
Matt members
Matt admin
Matt other
Matt sysadmin

[sig]<p>Matthew Wall<br><a href=mailto: > </a><br><a href= > </a><br> [/sig]
 
MAatt, you could try creating a variable before your loop starts, changing that variable when the loop finds your matching record, and setting the loop to only run as long as the variable is the original value. In other words, have your loop look at the variable and exit the loop when the variable changes. Does that help your situation? Or could you just use a simple select statement instead of looping through records? [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top