1

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 ...

Mahmood_N
  • 521
  • 9
  • 20
  • I want to Locate Record that have this values : UID := 11 , Pet = Dog Locate Should Return False when Record with ID = 11 is Selected in Master Table , but it Returns True – Mahmood_N Sep 08 '11 at 13:02

1 Answers1

1

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

DetailTable.Locate('UID; Pet', VarArrayOf([11, 'Dog']), [])
Sertac Akyuz
  • 54,131
  • 4
  • 102
  • 169