Yes, the code is correct. I had to remind myselft that lcChildId is set to the foreign key (which is backwards in my mind *s*).
Anyway, that said, maybe I'm wrong, but it seems like you can't have it both ways: if you enter a child record with a .NULL. foreign key, then you _have_ violated the restricted insert RI. Rereading your message, it seems to me that you do not in fact want to use "restricted."
...snip
>
>Second and more important, is the SEEK() returns .f. meaning the trigger will fail. If the Child table has NULL in the foreign key and the column allows NULLs the SEEK() shouldn't even occur. It should be more like:
>
>if IsNull( lcChildID) and DBGetProp( ChildTableForeignKeyColumn, "Field", "DefaultValue") = ".NULL."
> llRetVal = .t.
>
>else
> seek(....
>endif
...snip
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only