Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
End of file encountered
Message
From
04/07/2004 20:19:55
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
04/07/2004 16:48:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00920531
Message ID:
00920629
Views:
18
>hello,
>
>thank you for yor reply,
>
>realy i don't know, how i can do many things you advice me
>to do at my code ,
>if you use my code to show me how i can make my program better than know,
>
>thank you .
>
>regards

Really, the main idea here was to use SCAN, so you can:
  • Replace the DO WHILE... at the beginning, with a SCAN.
  • Replace the ENDDO at the end, with an ENDSCAN.
  • Eliminate the SKIP, since this is implicit in a SCAN.
  • Eliminate the GO TOP, since that is also implicit in a SCAN.
    Kli>Finally, as William Sanders pointed out, the filter is not necessary; it is easier to put a FOR in the SCAN.

    With all these changes, your code will look like this. I am commenting, with triple asterisks, the lines I eliminate. I am also putting a comment at the end of lines I added: && Added by Hilmar
    select 1
    m.no=no
    month1=month1
    m.year1=year1
    m.dd= month(date())
    m.ff=year(date())
    
    *** set filter to month1=m.dd .and. year1=m.ff
    *** go top
    *** do while .t.
    SCAN FOR month1=m.dd .and. year1=m.ff && Added by Hilmar
    
    thisform.text3.value=dat
    thisform.text1.value=total
    thisform.text6.value=month1
    thisform.text32.value=year1
    thisform.text2.value=amount1
    ************************************
    select 4
    *use temp2
    append blank
    replace no with m.no
    replace m1 with thisform.text6.value
    replace amount1 with thisform.text2.value
    replace year1 with thisform.text32.value
    select 1
    *** skip && i get here end of file counterd som times 
    m.no=no
    *** if eof()
    *** exit
    *** endif
    *** enddo
    ENDSCAN && Added by Hilmar
    
    
    select 4
    report form tab3 preview
    zap
    For the cursor, see CREATE CURSOR in the help.

    Also see my other suggestions in my other message - you don't need to implemente them all at once! But in the case of SCAN, there are several related parts.

    HTH,

    Hilmar.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform