Subject Re: [IBO] invalid date value raises exception
Author Jason Wharton

>I have a field in a database that has an invalid date and raises an
> exception with the following message:
> '-6406.0' is not a valid timestamp
> I don't know how to get around this. I tried the following code:
> lField := Dataset.FieldByName('DOB');
> if lField.AsFloat < 0 then
> begin
> //Assert(lField.Dataset.OnCalcFields = qryPersonCalcFields);
> lField.Dataset.OnCalcFields := nil;
> try
> SetFloatValue(lField, EncodeDate(1960, 1, 1));
> finally
> lField.Dataset.OnCalcFields := qryPersonCalcFields;
> end;
> end;
> but in the .AsFloat property the .AsDateTime property is called, and
> it raises the exception.
> Is there anyway I can check the data to see if it is valid, avoiding
> the exception?

What is the underlying field/column type?

There are events in the TIB_Column you can use. OnValidate should do it. You
have to make your own method and assign this in the AfterPrepare event.