Subject Re: [IBO] Caculated field
Author Jason Wharton
Send the sample please.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Vincent Bergeron" <info@...>
To: <ibobjects@yahoogroups.com>
Sent: Thursday, March 21, 2002 7:23 AM
Subject: [IBO] Caculated field


> Hi!
>
> I Have a simple query.
>
> Select * from Client in a TIB_Query. This TIB_Query's name is dbBug.
>
> I have a CalculatedField: C_CALCNOTEL varchar(25)
>
> In the OnCalculateField event, I have theses lines:
>
> with AField do
> begin
> if FieldName = 'C_CALCNOTEL' then
> begin
> asString := '('+ARow.ByName('C_CodeNoTel').asString+')'+
ARow.ByName('C_NoTel').asString;
> if ARow.ByName('C_NoTelPoste').asString <> '' then
> asString := asString + '#' +
ARow.ByName('C_NoTelPoste').asString;
> end;
> end;
>
> In the OnKeyPress of a TEdit, I have theses lines:
>
> if key = #13 then
> begin
> key := #0;
> if Edit1.Text <> '' then
> begin
> dbBug.Locate('C_Nom', VarArrayOf([Edit1.Text]),
[lopCaseInsensitive]);
> end;
> end;
>
> The TEdit purpose is to look for a particular name in the table.
>
> Finally, I have a grid that display about 10-15 records.
>
> Now... in the TEdit, when I enter a name that's not shown in the DBGrid, I
> get the following error:
>
> "Project Project1.exe raised exception class EIB_StatementError with
message
> 'FieldName: C_NoTelPoste not found'. Process stopped. Use Step or Run to
> continue"
>
> But the field exists. It's a physical field in the table.
>
> If I'm unclear, I've made a sample application that illustrate my
behavior.
>
> Thank you for your time.
>
> VB