Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report problem

Status
Not open for further replies.

EKC

Technical User
Jan 13, 2001
43
CA
Hi,
Report I try to make need to go through records in cursor and populate Cells in Excel.If two records are the same (have the same order and odline fields)then the second record should be skipped and only QTY field should be added to QTY field of previous one.So I have code like this that populate excel cells(c_reportis name of the cursor):

SELECT c_report
For i=1 to _TALLY
.Cells(i,1)=c_report.ohcust
.Cells(i,2)=c_report.order
.Cells(i,3)=c_report.odline
.Cells(i,4)=c_report.odpart
.Cells(i,5)=c_report.ipclas
.Cells(i,6)=c_report.ippgrp
.Cells(i,7)=c_report.ordate
.Cells(i,8)=c_report.QTY

goto i
EndFor


I had something like this:
if .Cells(i,2)=.Cells(i-1,2) and .Cells(i,3)=.Cells(i-1,3) Then
.Cells(i,8)=.Cells(i,8)+.Cells(i-1,8)
.Row(i).Delete
Endif
where .Cells(i,2)is order field
.Cells(i,3)is odline field
and .Cells(i,8)is QTY field
but it doesn't work.It just populate cells from cursor c_report.I think that I should compare those fields before they are displayed in cells but I don't know how.
I really need help on this so any idea appreciated,
Lyn


 
Hi
I wonder why you didn't take the easy way to do that by manipulating your data first in cursor or temp file using regular Fox Commands - which is easier than the COM interface of Excel and then just send your data already cooked and ready to eat to excel. Have fun
Thanks Walid Magd
Engwam@Hotmail.com
 
Walid,
How do you do that manipulating of data in cursor or temp file.Being begineer I realy don't know.Can you tell me which command you refer to or if you could give me code example I would realy appreciated it.
Thanks,
Lyn
 
Select field1, field2, field3, SUM(qty) as Tot_Qty FROM dbfFile WHERE your_conditionss GROUP BY field1 ... etc.. INTO CURSOR mycursor

The construct is available under help of 'SELECT -SQL' in VFP. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top