Hi,
I have a table which has an internal calculated field nHcap. It is a numeric field with values from 1 to 54. In the table I have another field which has a value of either 'Div 1', 'Div 2', or 'Div 3'.
I use a RadioGroup with these three values available for selection, and when a selection is made I filter the table to show only records that have a certain nCap value. These values are 'Div 1' from 1 to 17, 'Div 2' from 14 to 21, and 'Div 3' from 20 to 54. The OnCLick event for the RadioGroup looks like this:
procedure TfLadyMembers.rgDivsClick(Sender: TObject);
var
cChoice: String;
begin
dm.vMembers.Filtered:= False; //Start with clean slate
cChoice:= rgDivs.Items[ rgDivs.ItemIndex ];
with dm.vMembers do
begin
if cChoice = 'Div 1' then Filter:= 'nHcap < 17';
if cChoice = 'Div 2' then Filter:= 'nHcap > 13 AND nHcap < 21';
if cChoice = 'Div 3' then Filter:= 'nHcap > 20';
Filtered:= True;
end;
if cChoice = 'All' then dm.vMembers.Filtered:= False;
end;
The problem I'm seeing is that when 'Div 1' is first clicked the filter gives incorrect records. Clicking the other buttons gives correct results, and subsequent clicks on 'Div 1' gives the correct results. I've traced the code in debug mode and the correct select/filtering is executed, so why am I getting incorrect records on the first selection. Very odd.