Subject Re: Calculated field and Query
From Tim Ward <tim@goldengrovenurserydotcodotuk>
Date Mon, 10 Dec 2018 18:30:42 +0000
Newsgroups dbase.getting-started

On 10/12/2018 12:26, Dirk wrote:
> so i have to find a way to loop the info

Hi Dirk,
        If I wanted to mix table fields and calculated values into excel I'd
use something like the loop below. Doing this way you don't need to have
the table fields in the same order as the excel output and you can have
calculated fields where you require them. Sorry if my Dutch is not good.


rc.first()
do while not rc.EndofSet
    nRij++

    // column 2
    oCell= oExcel.activeSheet.Cells(nrij,2)
    ocell.formula = "'" + rf["kost"].value

    // column 3 ** Calculated value ***
    oCell= oExcel.activeSheet.Cells(nrij,3)
    ocell.formula = "'" + (rf["kost"].value * rf["Aantal stuks"].value )

    // column 4
    oCell= oExcel.activeSheet.Cells(nrij,4)
    ocell.formula = "'" + rf["eenheidsprijs"].value

    // etc...
        
    rc.next()
enddo

Tim