>cmd="select * from vouchers where vou_type='CR'and dr_amount>0 AND date=?f_date1 ORDER BY vou_no" >if sqlexec(con,cmd,'tab1')<0 > aerror(laerror) > messagebox(laerror[1,2]) > return >endif > >cmd="select * from cash_sum where vou_type='SC'and dr_amount>0 AND date=?f_date1 AND acc_code='2310001' ORDER BY vou_no" >if sqlexec(con,cmd,'tab2')<0 > aerror(laerror) > messagebox(laerror[1,2]) > return >endif > >cmd="select * from cashprp_sum where vou_type='PC'and CR_amount>0 AND date=?f_date1 ORDER BY vou_no" >if sqlexec(con,cmd,'tab3')<0 > aerror(laerror) > messagebox(laerror[1,2]) > return >endif > >cmd="select * from vouchers where vou_type='CP'and Cr_amount>0 AND date=?f_date1 ORDER BY vou_no" >if sqlexec(con,cmd,'tab4')<0 > aerror(laerror) > messagebox(laerror[1,2]) > return >endif > >create cursor chbook (vou_no n(10),date d(8),vou_type c(2),acc_code c(7),; > acc_name c(40), dr_amount n(13,2),cr_amount n(13,2),qty n(10),balance n(13,2),; > dr_cr c(3),code2 c(7),title2 c(60),list n(1),hello c(7 ),srno n(4),l n(1)) > >APPEND FROM DBF("tab1") >APPEND FROM DBF("tab2") >APPEND FROM DBF("tab3") >APPEND FROM DBF("tab4") > >>
TEXT TO cmd NOSHOW TEXTMERGE select * from vouchers where vou_type='CR'and dr_amount>0 AND date=?f_date1 ORDER BY vou_no select * from cash_sum where vou_type='SC'and dr_amount>0 AND date=?f_date1 AND acc_code='2310001' ORDER BY vou_no select * from cashprp_sum where vou_type='PC'and CR_amount>0 AND date=?f_date1 ORDER BY vou_no select * from vouchers where vou_type='CP'and Cr_amount>0 AND date=?f_date1 ORDER BY vou_no endtext if sqlexec(con,cmd,'tab') < 4 && 4 is the number of cursors you should be getting aerror(laerror) messagebox(laerror[1,2]) return endif create cursor chbook (vou_no n(10),date d(8),vou_type c(2),acc_code c(7),; acc_name c(40), dr_amount n(13,2),cr_amount n(13,2),qty n(10),balance n(13,2),; dr_cr c(3),code2 c(7),title2 c(60),list n(1),hello c(7 ),srno n(4),l n(1)) APPEND FROM DBF("tab") APPEND FROM DBF("tab1") APPEND FROM DBF("tab2") APPEND FROM DBF("tab3")In help for sqlexec() function, check the part where it says "multiple result sets". You can also include the additional parameter, the count array, where you will get the aliases of these cursors and their record counts.