some times customers enter data that when multiplied by other data produces a data width error in the dbf.
Is there a way to see where the width error is and fix on the fly thus eliminating the error message comining up and closing the program.
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local bOldErr := ErrorBlock()
MsgInfo( "Start Test" )
// Set this at the start of the main module
ErrorBlock( { |e| MyErrorHandler( e, bOldErr ) } )
RDDSetDefault( "DBFCDX" )
DbCreate( "T.DBF", { { "NUM", "N", 2, 0 } } )
USE T
APPEND BLANK
T->NUM := 1000 // This line normally produces runtime error.
CLOSE DATA
msginfo( "End of Program" )
return nil
function MyErrorHandler( e, bOldErrHandler )
if e:SubCode == 1021
MsgAlert( e:Description + CRLF + ;
"FIELD : " + e:Operation + CRLF + ;
ProcName( 2 ) + CRLF + ;
"Line : " + LTrim( Str( ProcLine( 2 ) ) ) )
// Decide what the programmer wants to do here
return .f.
endif
return Eval( bOldErrHandler, e )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 93 guests