lcFolder = [d:\data] if len(lcFolder) > 3 and not directory(lcFolder) md (lcFolder) endif select distinct year(date1) as nYear from Weights into cursor crsYears select crsYears scan lnYear = crsYears.nYear for lnI = 1 to 12 lcFile = transform(lnYear) + padl(lnI, 2, [0]) SELECT * FROM weights ; WHERE MONTH(date1) = lnI and YEAR(Date1) = lnYear ; INTO TABLE ADDBS(lcFolder) + lcFile endfor endscan>Dear Experts
>FOR p_count = 1 TO 12 > file_name = ALLTRIM(STR(p_count)) > SELECT * FROM weights WHERE MONTH(date1) = p_count INTO TABLE d:\ahsan+(file_Name) >NEXT >CLOSE ALL >>But above codes retreive data of only last month as well as create one dbf instead of 12.