>Dear Experts
>
>I have a table entitled "WEIGHTS", index on field "DATE"
>
>The date field has data as
>
>24/07/2004
>02/08/2004
>11/09/2004
>01/01/2005
>15/02/2005
>
>I want to divide this table into 12 tables, every table will hold data of a different month. For example the first table will be 072004.
>
>For this I wrote following codes
>
>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.
>
>Note: Index is on DATE field.
>
>Please help
What is the name of the one table that's created? Probably not creating a new name in the loop. I know it's not a great work around but I do something like:
cSQL = "SELECT * FROM weights WHERE MONTH(date1) = " ;
+ (p_count) ;
+ " INTO TABLE d:\ahsan " + (file_Name)
?cSQL
&cSQL
HTH
Jim Philippi
quando omni flunkus moritati