Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLE - Table to Excel file?
Message
From
10/09/1998 13:57:43
 
 
To
10/09/1998 11:11:36
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00135005
Message ID:
00135153
Views:
11
Perry ---

OK......let's try THIS:
LOCAL cSelStmt,cInsFlds,cInsVals
cSelStmt=""
cInsFlds="("
cInsVals="("
USE table
FOR i = 1 TO FCOUNT()
   cSelStmt=cSelStmt+IIF(i#1,",","")+"SUM("+FIELD(i)+") AS sum"+FIELD(i)
   cInsFlds=cInsFlds+IIF(i#1,",","")+FIELD(i)
   cInsVals=cInsVals+IIF(i#1,",","")+"sumtable.sum"+FIELD(i)
ENDFOR
cSelStmt=cSelStmt+" FROM table INTO CURSOR sumtable"
cInsFlds=cInsFlds+")"
cInsVals=cInsVals+")"
SELECT &cSelStmt
INSERT INTO table &cInsFlds VALUES &cInsVals
USE IN sumtable
I have no means to test this but it should work.






---
>
>Try this:
>
>SELECT SUM(field2) AS sumf2,SUM(Field3) AS sumf3, (..et al) ;
> FROM mytable INTO CURSOR summarytable
>INSERT INTO mytable (field2,field3....) VALUES (summarytable.field2,summarytable.field3,...)
>
>
>>
>>One question though. I'm trying to get the sum of each field to append as the last record in the table. Here's what i have:
>>
>>select xtab
>>go bottom
>>append blank in xtab nomenu
>>for lnCnt = 2 to fCount() && 2nd field is the 1st numeric field
>> lcFieldName = field(lnCnt)
>> replace &lcFieldname with sum(lcFieldName)
>>endfor
>>
>>should I add the table name lcFieldName = 'myTable.'+Field(lnCnt)??
>>
>>TIAA
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform