if chkbox_allowediting.Checked = True then begin; if (edt_dincode.Text = Material_Base_MainDataSet1.FieldByName('dincode').AsString) and (edt_nr.Text = Material_Base_MainDataSet1.FieldByName('Nr').AsString) then begin; // This is the same dincode+nr as in the dataset, so we are -definately- editing temp_dbindex:=Material_Base_MainDataSet1.FieldByName('dbindex').AsString; MaterialBase_ADOQuery1.Close; // At this point I was going to duplicate the code to calculate simulationamount // for use in updating records if there is no value in the simulationamount column. // But this situation should never arise because a value is inserted on creation // of item. If value is set to zero, that'll be because the user decided it should // be so, so we don't update anything here for simulationamount. - Sam, 260208 HKI end; MaterialBase_ADOQuery1.SQL.Text := 'UPDATE tbl_material_base set Description="'+edt_description.Text+'", Quantity="'+edt_quantity.Text+'", Units="'+edt_unit.Text+'", Type="'+cmb_type.Text+'", Man_Hours="'+edt_manhour.Text+'", Wages="'+edt_wages.Text+'", Material="'+edt_material.Text+'", Material_Unit="'+edt_material_unit.Text+'", Equipment="'+edt_equipment.Text+'", Additional="'+edt_additional.Text+'", Amount="'+edt_amount.Text+'" where dbindex="'+temp_dbindex+'"'; end; if chkbox_allowediting.Checked = False then begin; if chkbox_allowediting.Checked = True then chkstate := 'True, checked'; if chkbox_allowediting.Checked = False then chkstate := 'False, not checked'; showmessage('You cannot change the DIN code while editing an item'+#10#13+'To change the DIN code the item must be'+#10#13+'deleted and a new one created'+#10+#13+'Debug: Checkbox ticked: '+chkstate); cancel_update:='y'; end;