*orders.dbf ->opened by dataenvironment act_data=upper(dbc()) &&SAVE ORIGINAL DATABASE if param.cstat=1 &&save statistics *check statistics file cfi=alltrim(param.ordstatfile) if file(cfi) use (cfi) in 0 alias est_orders endif endif cursorsetprop("Buffering",5,"orders") sele orders replace dmodi with date(), usmod with suser(), .... if used("est_orders") &&apply statistics cursorsetprop("buffering",5,"est_orders") insert into statistics (nord,date,....) values(num_ord,date(),....) endif begin transaction if tableupdate(1,.T.,"orders") end transaction if used("est_orders") begin transaction if tableupdate(1,.t.,"est_orders") end transaction else rollback =tablerevert(.T.,"est_orders") messageb("Statistics can't be saved",16,"Error") endif endif else rollback =tablerevert(.T.,"orders") messageb("Orders can't be saved",16,"Error") endif ***RESTORING the database original adatabases(adats) for ix=1 to alen(adats,1) if upper(adats(ix,2))<>act_data set database to &adats(ix,2) close databases endif endfor set database to &act_data ***from here the database is going to show the same data