Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LOOP IN 'FOR.. ENDFOR' problem
Message
De
27/10/2004 10:25:05
Jim Winter
Jim Winter Consulting
Hinesburg, Vermont, États-Unis
 
 
À
27/10/2004 09:58:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
00954844
Message ID:
00954867
Vues:
20
>I have the following code:
>
>select mytable
>for i=1 to 10
>if seek (i,'mytable','id')=.f.
>messagebox('ID '+allt(str(i))+' Not Found!',0+16)
>return
>endif
>if mytable.status='C'
>messagebox('The operation will ignore from tube ID '+allt(str(i)))
>loop
>endif
>insert into mycursor value(i)
>
>The problem is that the code ignore from my 'Loop' (the id inserted even mytable.status='C')
>Who can help me?

Chaim,

Haven't tested it, but something like this should work:
LOCAL llExists
SELECT MyTable

FOR i = 1 TO 10

   llExists = SEEK(i, 'MyTable', 'ID')

   DO CASE 
      
      CASE llExists = .F.
         MessageBox('ID '+ ALLTRIM(STR(i)) + ' Not Found!',0+16)
         Return
      CASE MyTable.Status = 'C'
         MessageBox('The operation will ignore from tube ID ' + ALLTRIM(STR(i)))
      OTHERWISE
         INSERT INTO MyCursor VALUE(i)

   ENDCASE

ENDFOR
Regards,
Jim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform