Question

I have a Master-Detail Relationship between two Tables , I Select a Record in Master Table and its Details shows in Detail Table , next i want to Locate in Detail Table Only in Details about Master Table`s Selected Record but when I use ADOTable.Locate(...) , it locates in all Records of Detail Table !
For Example I have this Tables :

Master :

ID | Name

11 | Mahmood
22 | Maseoud

....

Detail :

UID | Pet(!)
11 | Cat
22 | Dog
22 | Cat

I have selected User "Mahmood" ( ID = 11) and in Detail Table only 1 Record shown with UID = 11 and Pet = Cat
Now I want to Locate on detail Table :
DetailTable.Locate('Pet', 'Dog', [])

"Locate" above returns " TRUE " whereas there is no Record with "Dog" value in details of Selected User

How can I solve this Problem ?
I want to Search in details of Selected Record in Master Table

Thanks before ...

Was it helpful?

Solution

TCustomADODataSet.LocateRecord works on an unfiltered clone, specify all relevant fields in your search:

DetailTable.Locate('UID; Pet', VarArrayOf([11, 'Dog']), [])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top