General information
Category:
Coding, syntax & commands
>The problem with the restrict RI sentence is:
>
>if you have a Master Table an A child Table, and the RI is restrict on update, when you insert or append blank a record in a child table and do not insert with a FK value, the RI Fails, becouse any value in the parent table is equal to the value qhat you are atempt to insert in your child table.
>
>Example
>
>Master Table
>ID Description
>1 First Record
>2 second Record
>3 another Record
>
>if you do this:
>Select Child Table
>Append Blank
>**In this moment the RI verify if any recod in the Master Table is equal to he value qhat you are insert in the Child table and generate a error.
>
>You have to do this:
>
>Inser into Child Table (ID) values (thisform.combo1.value)
>the RI verify the value inserted and this is into the Master Table and all is OK.
>
>Sorry with my English!
>
Fernando -
No problem with the English. If I understand you correctly, you're saying that the triggers fire as soon as you do the append blank, so at that point any child record won't have the key the master table is looking for. But I'm using table buffering with my address table, and thought I wouldn't have the error then.
Sylvia
>Spanish Version:
>
>Cuando se define la integridad referencial de una tabla primaria a una secundaria, la llave primaria de la tabla principal, se convierte en una llave foranea en la tabla secundaria, esto significa que si el desencadentante de insertar esta a restringir, cualquier valor ingresado en la tabla secundaria sobre el campo que sirve de llave foranea, debera existir primero en la tabla primaria.
>
>La mejor forma de hacerlo es utilizando el Comando Insert-SQl o creando un valor default en el registro de la tabla secundaria que haga referencia a la tabla primaria.
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