I'm writing an application using C++ Builder in which a database is searched using a lot of criteria. One of the queries involves creating a master/detail relationship. Creating such a relationship is not a problem. The problem appeares when I try to unset this relationship.

I use a TADOQuery object Q for my querries. In one of the queries i need this Q to be a details query. This is easely done by creating another query M and the following Q->DataSource = M and it works.

Later I need Q to get rid of the detail condition. Setting Q->DataSource = NULL doesn't work. After opening Q, when I try to filter the results I get the error "Filter property cannot be set on a detail table". What should I do in order such errors not to occur?

Note that I have run the program step by step and before filtering the results Q->DataSource is set to NULL.

Thank you for your help