You can log the error in dbf table with the help of following code.
ERRLOG.PRG code
ON ERROR DO errHandler WITH ;
ERROR(), MESSAGE(), MESSAGE(1), PROGRAM(), LINENO()
clear
USE nodatabase
PROCEDURE errHandler
PARAMETER merror, mess, mess1, mprog, mlineno
CLEAR
? 'Error number: ' + LTRIM(STR(merror))
? 'Error message: ' + mess
? 'Line of code with error: ' + mess1
? 'Line number of error: ' + LTRIM(STR(mlineno))
? 'Program with error: ' + mprog
USE ErrorLog
APPEND BLANK
replace errorno WITH LTRIM(STR(merror))
replace errmsg WITH mess
replace errline WITH mess1
replace lineno WITH LTRIM(STR(mlineno))
replace progname WITH mprog
replace errdatetim WITH DATETIME()
ENDPROC
Structure for table: ERRORLOG.DBF
Number of data records: 7
Date of last update: 04/09/23
Code Page: 1252
Field Field Name Type Width Dec Index Collate Nulls Next Step
1 ERRORNO Character 10 No
2 ERRMSG Character 254 No
3 ERRLINE Character 254 No
4 LINENO Character 10 No
5 PROGNAME Character 50 No
6 ERRDATETIM DateTime 8 No
** Total ** 587