Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: CF
  Where is CF?
 Colmar
 Pennsylvania - Poland
 CF
 To: Michael Gill
  Where is Michael Gill?
 Flora
 Illinois - United States
 Michael Gill
 Tags
Subject: RE: Use SCAN ALL instead of DO WHILE >> michael
Thread ID: 21927 Message ID: 21936 # Views: 24 # Ratings: 0
Version: Visual FoxPro 7 Category: General VFP Topics
Date: Friday, April 04, 2003 7:09:13 PM         
   


> > > > > Does anyone know why my do while !EOF() loop will only do the first record and then exit even though there are alot more records in the source cursor?
> > > > >
> > > > >
> > > > >   SELECT lineno, sono, item, loctid, qtyord-qtyshp AS qtyord, picked, whmap, RECNO("a") AS recno ;
> > > > >     FROM (m0sotranf) a WHERE sono = lc_sono AND sostat=' ' AND sotype$" O" ;
> > > > >     ORDER BY 1 INTO CURSOR C_first
> > > > > bROW  
> > > > >   GO TOP
> > > > >   DO WHILE !EOF()  && Will only go through first record then exit
> > > > >   	  ln_memcount = MEMLINES(whmap)-1
> > > > >   	  *IF ln_memcount > 1
> > > > >   	  FOR i = 1 TO ln_memcount
> > > > >   	  
> > > > >   	    lc_str      = MLINE(whmap, i)
> > > > >   	    lc_chkitem  = SUBSTR(lc_str, 1, 15)
> > > > >   	    lc_pickloc1 = SUBSTR(lc_str, 16, 6)
> > > > >   	    lc_pickq1   = VAL(SUBSTR(lc_str, 22, 5))
> > > > >   	    lc_vndid1   = SUBSTR(lc_str, 27, 6)
> > > > >   	    lc_pickloc2 = SUBSTR(lc_str, 33, 6)
> > > > >   	    lc_pickq2   = VAL(SUBSTR(lc_str, 39, 5))
> > > > >   	    lc_vndid2   = SUBSTR(lc_str, 44, 6) 
> > > > >     	
> > > > >     	SELECT a_tmpf1 
> > > > >   	  
> > > > >   	    APPEND BLANK
> > > > >   	    REPLACE Lineno WITH c_first.lineno, ITEM WITH c_first.item, BOM WITH lc_chkitem, LOCTID WITH c_first.loctid, ;
> > > > >   	            QTY WITH c_first.qtyord, pickloc1 WITH lc_pickloc1, pickq1 WITH lc_pickq1, VndID1 WITH lc_vndid1,;
> > > > >   	            pickloc2 WITH lc_pickloc2, pickq2 WITH lc_pickq2, VndID2 WITH lc_vndid2
> > > > >   	    REPLACE oqty WITH qty, opickloc1 WITH pickloc1, opickq1 WITH pickq1, OVndID1 WITH VndID1;
> > > > >   	            opickloc2 WITH pickloc2, opickq2 WITH pickq2, OVndID2 WITH VndID2, recno WITH c_first.recno
> > > > >   	
> > > > >       ENDFOR
> > > > >       *ENDIF
> > > > >   SKIP
> > > > >   ENDDO
> > > > > 

> > > > IS it because I have to change back to the original table before the
SKIP
or something to that effect?
> > >
> > > Let me clarify a bit more, I added a
SELECT C_first
right before the skip and it does go to the next record but then
SELECT a_tmpf1
gives a cannot find alias error after a random amount of records. I hate these kind of intermittant errors.
> >
> > If you use SCAN ALL ENDSCAN you shouldn't have the problem.
> >
> > KTB
>
> Hey Ken, don't you still have to set the active work area back with SCAN ... ENDSCAN? I agree that it's easier to use than the DO WHILE and it does the SKIP for you, but I think you still have to keep an eye on the work areas.
>
> ---
>
> www.foxite.com - The Home of the Visual FoxPro Experts

Michael,

I've done similar things with switching work areas and sometimes it worked, somtimes it didn't. Do you know of any possible explanation? Also, when you refer to the
INSERT
command do you mean the SQL or the other one(which the help file basically describes as legacy)

Thanks for the quick reply guys.


COMPLETE THREAD

DO WHILE in a cursor problem Posted by bleech67 toms @ 4/4/2003 5:02:05 PM
RE: DO WHILE in a cursor problem Posted by bleech67 toms @ 4/4/2003 5:28:19 PM
RE: DO WHILE in a cursor problem Posted by bleech67 toms @ 4/4/2003 6:05:06 PM
RE: DO WHILE in a cursor problem Posted by Michael Gill @ 4/4/2003 6:41:21 PM
Use SCAN ALL instead of DO WHILE Posted by Ken Blum @ 4/4/2003 6:42:10 PM
RE: Use SCAN ALL instead of DO WHILE Posted by Michael Gill @ 4/4/2003 6:51:13 PM
RE: Use SCAN ALL instead of DO WHILE >> michael Posted by bleech67 toms @ 4/4/2003 7:09:13 PM
RE: Use SCAN ALL instead of DO WHILE >> michael Posted by Michael Gill @ 4/4/2003 8:17:09 PM
RE: Use SCAN ALL instead of DO WHILE >> BTW Posted by bleech67 toms @ 4/4/2003 10:19:33 PM
For Michael - SCAN - ENDSCAN Select Posted by Ken Blum @ 4/7/2003 4:30:06 PM
RE: For Michael - SCAN - ENDSCAN Select Posted by Michael Gill @ 4/7/2003 4:57:21 PM
LOL Posted by bleech67 toms @ 4/4/2003 9:53:08 PM
RE: DO WHILE in a cursor problem Posted by Lou Harris @ 4/5/2003 2:14:22 AM
RE: DO WHILE in a cursor problem Posted by Argie Badua @ 4/7/2003 9:51:09 AM