Maybe you need a form propery and set its value in GotFocus - LostFocus of your grid.
Something like...
Grid GotFocus event:
THISFORM.TargetTable = '{child_table}'
Grid LostFocus event:
THISFORM.TargetTable = '{parent_table}'
and AddNew() nethod of your form...
DO CASE
CASE THISFORM.TargetTable = {parent_table}
... insert code for parent table
CASE THISFORM.TargetTable = {child_table}
... insert code for child table
ENDCASE
Dorin
>Hi All,
>i want to do with my toolbar like below,
>
>i have standart toolbar and its loading while application start,and i am using this technic (_vfp.activeform.addnew() all of codes ) to tell the toolbar what to do .with the non relational forms there is no problem . with OneToMany forms i want to do that , for example when the user click to any txt textbox then click edit or delete or new button toolbar should use parent table when user click to grid toolbar should use the child table and add,new,edit buttons behavior for row insert,delete and edit .
>
>How can i do this ?
>
>TIA