Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Record is out of range
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01173246
Message ID:
01173297
Views:
8
This message has been marked as a message which has helped to the initial question of the thread.
Hi Naomi,

How about changing your OUTER SCAN to use a different alias, then you don't have to worry about record pointers, skipping, changing alias, etc... Something like this...
select YourCurrentAlias
use (dbf()) again alias MyScanAlias in 0
select MyScanAlias
set order to OrderYouWant
scan while / for
    call your function to calculate sum based on "YourCurrentAlias"
    select MyScanAlias
    replace MyFields in this work area
endscan

use in MyScanAlias
You'll obviously need to consider some slight change in code where it may need to look at the new "MyScanAlias" cursor name instead. But this SHOULD allow for a cleaner solution.






>>Hello Naomi,
>>
>>>I have a table set in the particular order and then a
>>>
>>>I'm doing a SCAN on the table with some FOR and WHILE conditions.
>>
>>I take it that you're doing the SCAN based on some criteria. What is
>>this criteria, and is it being met?
>>
>>>In the beginning on the scan I'm saving recno, then there are some calculations
>>>involving this table, then I restore order on this table and goto saved recno.
>>>I also update some fields in this table that don't participate in FOR/WHILE.
>>
>>This last line that you wrote. You could be changing/advancing the record pointer,
>>yet SCAN thinks nothing has changed, and that you're still on the same record; therefore,
>>your program might be trying to seek past EOF, in which case SCAN would
>>return the error you describe.
>>
>>Or, your search criteria is not being met at all, and SCAN is letting you
>>know (in it's own way) that nothing was found.
>>
>>>I'm getting record is out of range on the ENDSCAN command.
>>>
>>>Do you know why I'n having this problem and how can I fix it?
>>
>>It sounds like you are inadvertently changing the record pointer,
>>and SCAN is getting confused. Either that, or your criteria is
>>not being met.
>>
>>Hope this helps,
>>
>>Randall
>
>Randall,
>
>Thanks a lot for your reply. This is actually not my code, I'm just trying to make it work. Basically, originally the table is in particular order and it's scanned while code = lcCode FOR some criteria. In the middle of the scan loop there is another procedure called that sums records from the same table using different order. Then I restore the order and the record pointer.
>
>However, I found, that my table doesn't have an order set at the moment of this error, which is strange, since I have SET ORDER TO 1 in the loop...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform