Board index » delphi » filter for field containing spaces in the field name

filter for field containing spaces in the field name

I am new at Delphi, done Paradox before. In Delphi I inserted a previously created Paradox table and I try to filter on different fields.
If I filter on a fieldname with no spaces, like in :
  Table1.Filter := 'Readmission = ' + QuotedStr(ReAdm.Text);
  Table1.filtered := True;
it works. If I filtered on a field with spaces, like in
  Table1.Filter := 'Baby Name = ' + QuotedStr(BN1.Text);
  Table1.filtered := True;
it doesn't work (Field 'Baby' not found). I tried Baby_Name (with underscore), the same (Field 'Baby_Name' not found)
I tried '''Baby Name'' + ' = ' + QuotedStr(BN1.Text); and I get a BDE exception 'Operation not aplicable'

It's probably very simple. I am very pleased with my daily discoveries about Delphi, but it's a lot to learn, and some little things can become very frustrating.
Thank you.

Ion Buicliu
Univ of Alberta
Edmonton, Alberta, Canada

 

Re:filter for field containing spaces in the field name


Use square brackets to enclose the field name:

    [My Field With Spaces] = 'Some value'

Woody

Re:filter for field containing spaces in the field name


Enclose the field name within Brackets -- [Baby Name]

--
Brad Prendergast
http://www.bpsoftware.com/Delphi.htm

Quote
"Ion Buicliu" <i.buic...@ualberta.ca> wrote in message

news:39ca286c$1_1@dnews...
Quote

> I am new at Delphi, done Paradox before. In Delphi I inserted a previously

created Paradox table and I try to filter on different fields.
Quote
> If I filter on a fieldname with no spaces, like in :
>   Table1.Filter := 'Readmission = ' + QuotedStr(ReAdm.Text);
>   Table1.filtered := True;
> it works. If I filtered on a field with spaces, like in
>   Table1.Filter := 'Baby Name = ' + QuotedStr(BN1.Text);
>   Table1.filtered := True;
> it doesn't work (Field 'Baby' not found). I tried Baby_Name (with

underscore), the same (Field 'Baby_Name' not found)
Quote
> I tried '''Baby Name'' + ' = ' + QuotedStr(BN1.Text); and I get a BDE

exception 'Operation not aplicable'
Quote

> It's probably very simple. I am very pleased with my daily discoveries

about Delphi, but it's a lot to learn, and some little things can become
very frustrating.
Quote
> Thank you.

> Ion Buicliu
> Univ of Alberta
> Edmonton, Alberta, Canada

Other Threads