Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
In negative territory...
Message
 
 
To
20/06/2006 14:15:16
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01130247
Message ID:
01130330
Views:
20
>Naomi:
>
>Status bar reports correct table/view and actual record pointer position.
>Come to think of it, I don't recall seeing a negative number in the status bar. Anyway...
>Cursorgetprop("buffering")=5
>
>Here's the code.
>local lnrec
>
>store 0 to lnrec
>select v_view
>if reccount()>0
>	if !eof() .and. !deleted()
>		lnrec=recno()
>	else
>		go bottom
>		lnrec=recno()
>	endif
>	go top
>	scan while !eof() .and. !deleted()
>		replace ...
>	endscan
>	locate for recno()=lnrec
>	if !found()
>	        go top
>	endif
>endif
>
>return
>
>I suspect it's the 'locate for' but 'go' doesn't return the user to the same line/record they were on.

Maybe lnrec is zero when the failure/error occurs? Do you have an index on the cursor? If so, is it indexed on recno()? If so, get rid of that index. An out-of-range error should not happen even if the lnrec is less than 0.

Anyway, after the ENDSCAN, try this instead:
if lnrec <> 0
   goto lnrec
else
   locate
endif
If that still gives you a problem, try:
local lcOldError, llFindError
lcOldError = on('error')
llFindError = .f.
on error llFindError = .t.
if lnrec <> 0
   goto lnrec
else
   locate
endif
on error &lcOldError
if llFindError or eof()
   locate
endif
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform