Board index » delphi » Date Field in Paradox

Date Field in Paradox

Hi

I have a paradox table for training records as follows

EmpNo            = Alpha
ModuleRef       = Alpha
TrainingStatus = Alpha
DateTrained    = Date
ReviewDate    = Date (auto generated 2 years after date trained)

The TrainingStatus field can be

T = Trained
TR = Training Required
R = Refresher Training
X = Not Required

I am using  a query component to populate the table with parameters.
This works fine however, if I want to add a record were the
TrainingStatus is TR or R or X.  I don't want to enter any date
parameters.  The problem is that if I miss out these Delphi
automatically inserts 31\12\1899

Any answers as to how this can be prevented

many thanks

Andy Law

 

Re:Date Field in Paradox


Something is causing zero to be inserted as the date instead of null.  You
can change the data to null using

Table1.FieldByName('ReviewDate').Clear;

--
Bill

(TeamB cannot answer questions received via email.)
(To contact me for any other reason remove nospam from my address)

Re:Date Field in Paradox


Quote
On Wed, 03 Jun 1998 18:38:41 GMT, a...@law.u-net.com (Andy Law) wrote:
>Hi

>I have a paradox table for training records as follows

>EmpNo            = Alpha
>ModuleRef       = Alpha
>TrainingStatus = Alpha
>DateTrained    = Date
>ReviewDate    = Date (auto generated 2 years after date trained)

>The TrainingStatus field can be

>T = Trained
>TR = Training Required
>R = Refresher Training
>X = Not Required

>I am using  a query component to populate the table with parameters.
>This works fine however, if I want to add a record were the
>TrainingStatus is TR or R or X.  I don't want to enter any date
>parameters.  The problem is that if I miss out these Delphi
>automatically inserts 31\12\1899

>Any answers as to how this can be prevented

>many thanks

>Andy Law

That is the base date of a TDateTime. It is stored as a floating point
number where the integer part is the number of days since that day. If
you're getting a zero out of that field and converting it to a
floating point number, then that's what you'll get. It's hard to say
how to prevent it without seeing your code, but perhaps that will
point you in the right direction.

Steve F (Team B)

Other Threads