Hi,
VFP9, Win XP Pro SP2
The following code in a class causes frequent but inconsistent crashes - it
may work several times and then crash - the error is fatal error: exception
code C00..005 with a reference to the last line of the SQL statement.
I have restarted, turned the PC off and on, cleaned up the class, copied the
code to a new method and tried a few work arounds (the original code is
commented out).
Any suggestions as to what else to try would be great.
John Pugh
Adelaide, South Australia
LPARAMETERS tn_id_emp,tc_filter &&, tn_Data_Session
CASE EMPTY(tn_id_emp) &&OR EMPTY(tn_Data_Session)
WAIT WINDOW 'Both parameters must be passed to main.calc_tax'
RETURN
ENDCASE
*SET DATASESSION TO tn_Data_Session
* Calculate the component for the passed params
LOCAL lc_filter,lc_tab_fld,ln_amount
* Build the name of the table.field to test
lc_tab_fld='pay_cats.'+tc_filter
* Calculate the amount
lc_filter= 'WHERE pay_line.id_emp=tn_id_emp'
lc_filter=lc_filter+' AND pay_line.id_pay_ref=params_pay.id_pay_ref'
lc_filter=lc_filter+' AND '+lc_tab_fld+' = .T. '
* See if the following stops it crashing...
SELECT pay_line.amount;
FROM pay_line ;
JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
JOIN pay_cats ON pay_cats.id_key=pay_cats_e.id_pay_cat ;
&lc_filter ;
INTO CURSOR cur_tran_calc
SUM cur_tran_calc.amount TO ln_amount
* The following kept crashing so the filter was built
*!* SELECT SUM(pay_line.amount) AS amount;
*!* FROM pay_line ;
*!* JOIN pay_cats_e ON pay_line.id_p_cat_e=pay_cats_e.id_key;
*!* JOIN pay_cats ON pay_cats_e.id_pay_cat=pay_cats.id_key;
*!* WHERE pay_line.id_emp=tn_id_emp;
*!* AND pay_line.id_pay_ref=params_pay.id_pay_ref;
*!* AND &lc_tab_fld = .T. ;
*!* INTO CURSOR cur_temp nofilter