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: Eric den Doop
  Where is Eric den Doop?
 Houten
 Netherlands
 Eric den Doop
 Tags
Subject: RE: Record is out of range (Error 5)
Thread ID: 23796 Message ID: 23832 # Views: 5 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Wednesday, May 21, 2003 9:09:03 PM         
   


> >
> > Hello, it's my first post so i hope you understand my question.
> > I am working at the supportdepartment for our software zo i don't have the acces to the sourcecode.
> >
> > A user of our software (foxpro 6.0) gets several times a day error: Record is out of range (Error 5).
> > The message is on different workstations (win98)
> > Our programmer said he don't now why the error occured, but he thougt that an upgrade to winXp will solve the problem.
> > Does anybody knows if this realy can be an solution, or do you have an other idea.
>
> This error is usually caused by a bad index or by the programmer. This is definitaly NOT related to the operating system. Try to reindex the tables (or ask the programmer to do that). If that fails, then there is a bug in the software. For example, if a table has 10 records and there is a line in the code like GOTO 12 then you'll get this error because the code is trying to access a record that does not exist.
> --
> Eric den Doop
> www.foxite.com - The Home Of The Visual FoxPro Experts

I had alot of problems recently with this error and it is my own fault (kind of). In my case I read the recno() from a wron table and when I tried to SEEK() the record I got the "out of range error"

It seems foxpro is a little crazy sometimes, for e.g.

SELECT a_sotran
   DO WHILE !EOF()
       SELECT a_tmpf1
          DO WHILE ! EOF()
             IF qtyord > 0 
                Replace qtyord WITH qtyord + 5
             ENDIF 
           SKIP 
        ENDDO
     SKIP 
  ENDDO
**The code above would confuse itself sometimes and not choose the correct table (don't ask why but I've seen it happen many times)
**As I fix I use what I call 'Relative programming' (opposed to 'absolute' above) and it always seems to work despite adding additional code

   DO WHILE !EOF("a_sotran")
          DO WHILE ! EOF("a_tmpf1")
             IF a_tmpf1.qtyord > 0 
                Replace a_tmpf1.qtyord WITH a_tmpf1.qtyord + 5
             ENDIF 
            SKIP IN a_tmpf1
          ENDDO
       SKIP IN a_sotran
  ENDDO


Off topic but as a side note - I have seen a weird problem where 'REPLACE' would not do anything Instead I use SQL 'INSERT' Which worked fine

I hope it gives you some idea(s)

Toms


COMPLETE THREAD

Record is out of range (Error 5) Posted by Theo Bauhuis @ 5/21/2003 11:32:13 AM
RE: Record is out of range (Error 5) Posted by Eric den Doop @ 5/21/2003 12:24:00 PM
RE: Record is out of range (Error 5) Posted by bleech67 toms @ 5/21/2003 9:09:03 PM
Hmm - so much for indenting - it unindented -NT Posted by bleech67 toms @ 5/21/2003 9:10:35 PM