i have posted some code below which causes an issue after it has run. i wondered if someone could see an obvious problem.
user runs this script using an onchange event in a combo box. after the code which changes the advisers name in another table has run, the current record is dropped and the form displays the first record in the database.
thanks
richard
user runs this script using an onchange event in a combo box. after the code which changes the advisers name in another table has run, the current record is dropped and the form displays the first record in the database.
Code:
'Conditional code follows. Executes only if the condition expression is True. IF a5_eval_expression("=Stage=\"Lead\"") THEN 'chane case onwer to new adviser if adviser changed and case not written DIM form_name as c if is_object(topparent.this) then form_name = topparent.name()+".this" else form_name = "" end if DELETE expression_result expression_result = eval("Adviser",form_name) parentform:Case_owner.value = expression_result END IF 'Displays a message box (style:'OK Button', image: 'Information symbol', id: 'd_adviser_change'). DIM SHARED dadviserchange_result as N DIM SHARED dadviserchange_OK_Button as L dadviserchange_OK_Button = .F. title_var = "Change Adviser" message_text_var = <<%text% Changing the Adviser for this case will change all future reviews to the adviser. The new adviser assumes all responsibility for advice given from this date. %text% dadviserchange_result=ui_msg_box(title_var,message_text_var,UI_OK+ UI_FIRST_BUTTON_DEFAULT+ UI_INFORMATION_SYMBOL) 'Test to see which button on the message box was pressed.... SELECT CASE dadviserchange_result = UI_OK_SELECTED dadviserchange_OK_Button= .t. END SELECT 'Conditional code follows. Executes only if the condition expression is True. IF a5_eval_expression("=Var->varC_result=\"OK\"") THEN 'change adviser in any open reviews for this case dim tc as P dim tbl as P dim new_adv as c tc = table.current() tbl = table.open("treview") new_adv = casefile->adviser query.filter = "Caseref=" + quote(tc.caseref) query.order = "" query.options = "" qry = tbl.query_create() nrecs = qry.records_get() IF nrecs = 1 then tbl.change_begin() tbl.R_adviser= new_adv tbl.change_end(.T.) End if qry.drop() query.filter = "" query.order = "" query.options = "" tbl.close() END IF 'Conditional code follows. Executes only if the condition expression is True. IF a5_eval_expression("=Var->varC_result=\"OK\"") THEN 'enter note to confirm adviser changed dim tbl as P dim v_trns_adv as c tbl = table.open("tnotes") tbl.enter_begin(.T.) tbl.caseref=casefile->caseref tbl.noteaddedby=user_name() tbl.notedate=date() tbl.notecategory="Change Adviser" tbl.noteinfo="Adviser changed to" + " " + casefile->adviser + " " + " who assumes repsonsibility for all advice from this date" tbl.Notereason="Adviser Changed" tbl.enter_end(.T.) tbl.close() END IF 'Save record in current form at parent level. topparent.commit()
richard
Comment