Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IF..ELSE..ENDIF statement
Message
From
03/11/1997 01:11:28
 
 
To
02/11/1997 23:30:49
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00057913
Message ID:
00057916
Views:
27
>Dear all, > >I need all the help I can get.Please do help. THanks in advance. >Here's my problem. > >DO WHILE thisform.check = .f. >thisform.aperiod = thisform.aperiod + 1 >if thisform.aperiod > acperiod >thisform.aperiod = 1 >thisform.ayear = thisform.ayear + 1 >endif >thisform.i = thisform.i + 1 >[ if thisform.text2.value = thisform.aperiod and; >thisform.text4.value = thisform.ayear >thisform.check = .t. >endif] >ENDDO > >Logically I think the part with [] works but something weird >happens instead, I do not know where I go wrong. >GIven thisform.aperiod the value of 10 and thisform.ayear=1997, >thisform.text2.value = 10 and thisform.text4.value = 1998 >when it reached the checking part [] the >thisform.ayear's value is changed back to 1997 causing >an endless loop. Why does the IF..ELSE..ENDIF statement >not working? > >Dora The easiest thing to do: Put a SET STEP ON before the DO WHILE. This will open the debugger right before the DO WHILE and you can check the value of each variable, trace the code, etc. Now, in your case, for the first execution of the DO WHILE: aperiod is 10 and becomes 11. If 11 > acperiod then aperiod = 1 and ayear = 1998 else aperiod = 11 and ayear = 1997 In both cases (then or else) the next if is false, so check stays .f. What's the value of acperiod? Vlad Dear Vlad, I had use the wait window to check and got rid of the wait window statements . The loop is working fine now. Needs more testing though.Thanks a lot for your help. Glad to receive your mail. Thanks again. Dora
Previous
Reply
Map
View

Click here to load this message in the networking platform