Path: utzoo!utgpu!watmath!iuvax!rutgers!haven!grebyn!rwilliam
From: rwilliam@grebyn.com (Roger Williams)
Newsgroups: comp.databases
Subject: Re: dBASE IV (Again)
Summary: Try making x where x = recno() PUBLIC
Keywords: dBASE
Message-ID: <13988@grebyn.com>
Date: 1 Oct 89 22:50:40 GMT
References: <248@cerc.wvu.wvnet.edu.edu> <266@dbase.UUCP>
Organization: Grebyn Timesharing, Vienna, VA
Lines: 40



> Alastair Dallas in article <266@dbase.uucp> writes

> In article <248@cerc.wvu.wvnet.edu.edu>, coop@cerc.wvu.wvnet.edu (Boris Pelakh) writes:
> > I have a file with 1518 records in it. I do an append blank, then
> > assign recno() to a variable. It now contains 1519. I do some operations
> > on the file and then do a goto to that record #. dBASE gives me a 
> > "record out of range" error, but GOES to the right record !!! (after I
> > choose Cancel or Suspend on the popup that occurs, the record pointer
> > is at 1519. If I choose Ignore, the application keeps running without problems

> I went to duplicate your bug.  I created a 1518-record file and did:

> 	APPEND BLANK
> 	x = recno()
> 	
> 	GOTO x

> This doesn't cause any problem for me.  Of course, it could be that I
> picked different operations to try :-).  Could you be more specific?

I had the problem described by the poster of the initial article.

I found that preceding the  program with

PUBLIC x
.
.
x = recno()

GOTO x

solved the problem.  Apparently if the operations include a "Do"
statement the contents of x are lost if x is a private variable.
Defining x as a PUBLIC variable solves this problem.  Give it a
try anyway and see how it goes.

rtw
rwilliam@grebyn.com