General information
Category:
Coding, syntax & commands
Title:
Grid Not following Record Pointer
My whole code for the method. The messagebox at the end shows that the activerow is always one less than the recno. Any reason you can think of?
As for the problem of 'record is out of range', it was not happening anymore after I changed THISGRID.REFRESH to THISFORM.REFRESH.
#DEFINE THISGRID THIS.PARENT.PARENT
LOCAL nWorkArea, cRoll_no, nRoll_no, nRecNo, nCurRow, nCurCol, nLastRecNo
IF LASTKEY()!=13 OR MDOWN()
RETURN .T.
ENDIF
SELECT (THISGRID.RECORDSOURCE)
cRoll_no = ''
nRoll_no = 0
nRecNo = RECNO()
nCurRow = THISGRID.ACTIVEROW
nCurCol = THISGRID.ACTIVECOLUMN
GO BOTTOM
cRoll_no = THISGRID.COLUMNS(1).text1.VALUE
nLastRecNo = RECNO()
GO (nRecNo)
IF nRecNo <> nLastRecNo
SKIP
nRecNo = RECNO()
THISFORM.REFRESH()
ELSE
nRoll_no = VAL( RIGHT( ALLTRIM(cRoll_no), RAT('/',ALLTRIM(cRoll_no))-1) )+1
cRoll_no = LEFT(cRoll_no,RAT('/',cRoll_no)) + PADL(nRoll_no,4,'0')
APPEND BLANK
REPLACE pagr_key WITH pa_grade.pagr_key, roll_no WITH cRoll_no
nWorkArea=SELECT()
nRecNo = RECNO()
THISFORM.REFRESH()
SELECT (nWorkArea)
GO (nRecNo)
ENDIF
MESSAGEBOX(STR(nRecNo)+':'+STR(THISGRID.ACTIVEROW))
RETURN
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only