Detach

Takes 3 parameters, ParentTableName, ChildTableName, and a boolean expression (optional)

Usage:

ParentTableName, ChildTableName, IfLenFld
ParentTableName, ChildTableName, [""]
[WorkWith], ChildTableName, [""]
ParentTableName, ChildTableName, [WorkIf]
[WorkWith], ChildTableName, [WorkIf]

Description:

The command detaches each pair of Records in the Database for each pair of Records in the Work Query. There must be one Field in the Work Query named ParentTableName.Alias and one Field named ChildTableName.Alias; such as if attaching a MemTab.Contact Record as a Child of MemTab.Person, the Field names in the Work Query must be MemTab.Person.Alias and MemTab.Contact.Alias.

The value of each of the .Alias Fields in the WorkQuery must match the Aliases of the Records in the Database Tables to be detached from each other. If the value of either of the .Alias Fields in the WorkQuery are blank, it will be skipped without error.

If an error occurs during the execution of this command on one or more Records, the error message will be placed into a Field in the Work Query named Error. The Field named Error will be created automatically if needed and it does not already exist.

Example:

WorkWith      "ToDo.Item"
SetNew "Alias", `pItem
Parents "ToDo.Item", "ToDo.List"
FailIfRecError
End WorkWith
Detach "ToDo.List", "ToDo.Item"

*Note: The above example will detach the relationship between the parent and child, but neither record would have been deleted from the database.