>I am building a software for a repair shop
>
> I am using free tables
>
> I've created a table clients and a table devices
> In the table clients I have a field called "code"
> and in the table devices I have a field called "id"
>
> I created a relation between the fields code and id
> This relation was created in the dataenvironment
>
> I have a problem:
>
> When a client is deleted their devices stays still in
> the table devices
>
> I mean; if I delete client number #2 the devices with id # 2
> o the table devices will still be there.
>
> When a new client is added to the record # 2 of the table clients,
> he will get the devices of the table devices with id # 2
>
> How can I solve this problem ?
Moises,
You should set a relation from an parent field to an existing index on child. As I understand your relation is from devices to clients.
use devices
use clients order tag code in 0 && Assuming has an index on code
set relation to id into clients && Relation to code as it's active index
But instead if you do this (I think it's your problem) :
use devices
use clients in 0 && No order set
set relation to id into clients
VFP uses record numbers by default. ID#2 would always relate to clients rec#2.
If you clearly tell how a relation you want and how you would show it on form we can help further (it might be that you don't need to create any relation).
Cetin