Subject Heirachy of filtering/querying
Author Terry Black
Hi, I want to have a 'master filter' or query that allows me to choose to use either all records or only those marked as 'Active'. Then if I run run other queries they will follow my earlier choice of all the records or ony the active records

I have a number of queries that display the dataset
e.g
sname = 'BLOGGS'

DM.qrIEC.Close;
DM.qrIEC.SQL.LoadFromFile(IECPath + '\' + 'SurnameSelect.txt');
DM.qrIEC.ParamByName('SURNAME').Value := sname;
DM.qrIEC.Prepare;
DM.qrIEC.Open;

This shows all the records whose Surname = 'Bloggs'

If I want to display records that are both 'Active' and Surname = 'Bloggs' do I have to rewrite the query

DM.qrIEC.Close;
DM.qrIEC.SQL.LoadFromFile(IECPath + '\' + 'SurnameSelect.txt');
DM.qrIEC.ParamByName('SURNAME').Value := sname;
DM.qrIEC.ParamByName('RECORD').Value := 'Active';
DM.qrIEC.Prepare;
DM.qrIEC.Open;

or

is there some way of having an overall query or filter that shows all the records or only the 'Active' records then any queries after this follow my earlier choice of all the records or ony the active records.

Terry