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

breaking a loop from middle 1

Status
Not open for further replies.

vinanti

Programmer
Mar 7, 2003
26
IN
hi everybody,

I am working on a looping construct,and i want to break it the moment a condition is satisfied.i dont know how to do this,i have tried using break,end.i want the correct syntax for this,plz.

my code is:
for i=1 to tempcnt
chksav=Dlookup("[invoice no]","mast","[supplier name]'"=tempsupp"'"
msgbox "chksav"
if(chksav=Me.invoice_no)then
BREAK
endif
next
i=i+1
end

In the place of break what should i use,plz help.....
let me know if my syntax in the looping construct is wrong anywhere; i tried finding for loops in the help but all in vain.
I am using a looping construct in access for the first time.


any help is welcome..

thnks in advance

bye,
vinanti
 
for i=1 to tempcnt
chksav=Dlookup("[invoice no]","mast","[supplier name]'"=tempsupp"'"
msgbox "chksav"
if(chksav=Me.invoice_no)then
Exit For
endif
next
i=i+1
end

Bill
 
hi bill,

thnks a lot i'll try it right away,
i have another query as you can see above,i have used dlookup to fin records based a criteria;now i see that the row returned is the same record again and again it does not move to the next record in the database where the condition is fulfilled;plz help...


thnks again...
vinanti
 
Actually I'd start another Thread giving a lot more info on what you are trying to achieve, I didn't really look at your code. This Thread is "breaking a loop from middle". I'm unlikely to be able to get back to you today so the Thread might look completed to anyone else looking at it.

If you are not in a hurry though, post a more detailed explanation here and if someone else hasn't managed to help you, I'll have a go over the weekend.

Regards

Bill
 
hi bill,
i have posted another thread for the same plz. see if u can help...


bye vinatni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top