SELECT... WHERE x IN ......Please help

In TI2751 Borland says that SQL statments have a max length of 64 kB
if RequestLive:= false. Before opening a query I check for this.

procedure X
begin
....
If Not FilterRecords then
begin
try
If Query1.Prepared then Query1.Unprepare;
except
end;
end;
....
end;

function FilterRecords: Boolean;
var
MaxSC: integer;
const
MaxB= 64*1024;
begin
try
Query1.SQL.Clear;
Query1.SQL.Add('SELECT * FROM Company WHERE Company.PostCode in
('Code1','Code2',....'));
.....
.....
MaxSC:= Length(Query1.Text);  {actually 14 180}
If MaxB <= CharToByteLen(Query1.Text, MaxSC) then
Abort;
Query1.Prepare;
Query1.Open;
Result:= true;
except
Result:= false;
end;
end;

The Query work untill about 400 items 'CodeX' but if there are more and I
open Query1 I get an error in idsql32.dll. If I try to unprepare
Query1 I get Invalid page fault in kernel32.exe and somethimes the whole
system crash.(WIN95)
My Question: Is my const. for MaxB (64*1024) wrong or why Query1 doesnt
work. Is there a way to check if Query1 will work. Are there restrictions
for the IN statment ?
BDE Setings: MemSize: 24; SharedMemSize: 4096.

Thanks for help
--
Werner Zuglauer
i...@telecom.cz

http://www.iwer.cz