I have a detail table that I need to refresh independently of the master table; I’m using the close/open method.
If the master table is in dsEdit mode the detail table will not open, but the AfterOpen event is still called. This causes issues with any AfterOpen event handlers that (correctly) assume the table will be open.
There is a line in your code that says “If Master.State = dsBrowse” then … and it proceeds to open the table.
Either allow the table to be opened in dsEdit mode as well, or ensure that the after-open event isn’t called and there’s some warning to the developer…?
(mappingmode = mmWhere, detail and masteroptions are all default)
as designed. cloned tables works with original (i.e. not filtered) record set so it is a reason why cloned table contains all records.
also it is possible to use cloned tables as detail tables with different masters
as a workaround, you should filter records, i.e. specify mastersource as it was used in detail table.
Thx for testcase.
I can reproduce this case and it is related to TDADataTableRules.
unfortunately, TDADataTableRules disallows to use the detail tables with the same name because logic of these methods will be incorrect:
function FindDetail(const aLogicalName : string) : TDADataTable;
function DetailByName(const aLogicalName : string) : TDADataTable;
I can suggest to you just set LogicalName for cloned table as unique name (like VALIDATION_ERRORS_clone1) because LogicalName for cloned tables is useless because cloned tables share a record set with table from that they were cloned.