Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

record out of range 1

Status
Not open for further replies.

R17

Programmer
Jan 20, 2003
267
PH


i have this,

Code:
use leave
append blank
store recno() to nrec
.
.
.
go nrec

but why am i having a record out of range in "go nrec"?




 
You're trying to go to a record outside the table's scope... such as 'GO 10' in an 8 record table.

If you are trying to locate a specific record you may want to consider a primary key (unique identifier), or you could change your command to 'GO MAX(NREC,RECCOUNT())' or 'LOCATE FOR RECNO()>=NREC' etc. depending upon what you are trying to achieve.

Brian
 
I get this error sometimes.

It happens to me when I chenge work area(select table or cursor)

try to use this:

use leave
append blank
store recno() to nrec
.
.
.
use leave
go nrec
 


hi baltman,

when i append blank, shouldn't the recno() be equal to the last record?

 
Of course when You add a new record than recno() retun the last record number.
 
Bon011

Of course when You add a new record than recno() retun the last record number.

In my experience, when a table is buffered the Recno() of a new record return -1.
Code:
LOCAL nRec
SET MULTILOCKS on
CREATE TABLE c:\myTable (name c(20))
=CURSORSETPROP("Buffering",5,"myTable")
GO botto
APPEND BLANK
STORE RECNO() TO nRec
MESSAGEBOX(TRANSFORM(nRec))

In the case of an unbuffered table it returns the actual RECNO().
Code:
LOCAL nRec
CREATE TABLE c:\myTable (name c(20))
GO botto
APPEND BLANK
STORE RECNO() TO nRec
MESSAGEBOX(TRANSFORM(nRec))

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
I would guess that it is a record buffering problem as Mike Gagnon has outlined.

Code:
LOCAL nRec
SET MULTILOCKS ON
CREATE TABLE c:\myTable (name c(20))
=CURSORSETPROP("Buffering",5,"myTable")
GO BOTTOM
APPEND BLANK
STORE RECNO() TO nRec
MESSAGEBOX(TRANSFORM(nRec))
GO nRec &&Works Fine
=TABLEUPDATE() &&Now the record number -1 is gone
GO nRec &&Throws an error


Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 


yes mike, i have the table selected before i do nrec. mgagnon is right, nrec returns to -1.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top