>The parent table is client (fields id and name)
>
> The child table is products (fields product and id)
>
> I've created a relation and a form with 2 pages
> The first page has the client data and the second page has a grid
> with the products of the client
>
>
> The job I need is
>
>
> Select client
> go top
> frec = recno ()
>
> Get all the records in table product which is related to the
>the record in the parent table
> store to a txt file ( the txt file name will be named &frec)
>
> select client
> store skip + 1
> Get all the records in table product which is related to the
>the record in the parent table
>
> ... until the end of the table clientes
Moises,
As already there is a relation :
select client
scan
If !Eof('products')
lcFileName = ltrim(str(recno()))+'.txt'
select products
copy to (lcFileName) type delimited while id = client.id
endif
select client
endscan
Cetin