Subject WhereItems using query field
Author stanw1950
I'm using a tib_grid that display a lot of records and fields,
including a PartNumber field from a tib_query.
When the user clicks a button, I want to change the query to only
show the records with the current part number in the grid. I tried to
use InvalidateSQL (see below) and change the WhereItems in the
Onpreparesql procedure but I got no records. When I tried to use a
filter instead (see below), I always get the first part number in the
grid, never the current part number in the grid (unless it's the
first). Probably I have to use the buffer, but I can't figure out how
to. Thanks for any help anybody can provide. (D6,IBO4.2.hc)

Stan Walker

In MyQueryPrepareSQL procedure:
MyQuery.SQLWhereItems.Add('PARTNUMBER = ''' + MyQuery.FieldByName
('PARTNUMBER').AsString + '''');

Using filter:
MyQuery.Filter := 'PARTNUMBER = ''' + MyQuery.FieldByName
('PARTNUMBER').AsString + '''';
MyQuery.Filtered := true;