Board index » delphi » setting a paradox date field to null state?

setting a paradox date field to null state?


2004-08-06 04:34:58 PM
delphi224
I have a date field that is blank when the record is created. The user can
select to enter a time as part of the GUI. The user can also delete the time
and when they do that, I want to set the date field back to a null state (so
it shows as an empty field in a table view).
How would I do this if I was using TTable or TQuery?
Using D7, paradox.
Thanks.
 
 

Re:setting a paradox date field to null state?

Allan writes:
Quote
I have a date field that is blank when the record is created. The
user can select to enter a time as part of the GUI. The user can also
delete the time and when they do that, I want to set the date field
back to a null state (so it shows as an empty field in a table view).
How would I do this if I was using TTable or TQuery?
Using D7, paradox.
Use the Clear method of the appropriate field
e.g.
DataTable.FieldByName('EntryDate').Clear;
John Leavey
 

Re:setting a paradox date field to null state?

The fundamental difference on date fields on database are usually that the
data requires you to use ' or " around the date when storing into the
database, except when storing NULL you don't do that.
So I'd do an if statement to see if the field is empty then add NULL or
if the field is NOT empty then add the date with the ' sign around it. And
in the end just execute the SQL statement in a Query.
"Allan" <XXXX@XXXXX.COM>writes
Quote
I have a date field that is blank when the record is created. The user can
select to enter a time as part of the GUI. The user can also delete the
time
and when they do that, I want to set the date field back to a null state
(so
it shows as an empty field in a table view).
How would I do this if I was using TTable or TQuery?
Using D7, paradox.

Thanks.


 

Re:setting a paradox date field to null state?

Thanks John, the answer is so obvious I feel a real thicko for asking
it in the first place :)
"John Leavey" <johnl@[no_spam].compufile.co.uk>writes
Quote
Allan writes:

>I have a date field that is blank when the record is created. The
>user can select to enter a time as part of the GUI. The user can also
>delete the time and when they do that, I want to set the date field
>back to a null state (so it shows as an empty field in a table view).
>How would I do this if I was using TTable or TQuery?
>Using D7, paradox.


Use the Clear method of the appropriate field

e.g.

DataTable.FieldByName('EntryDate').Clear;


John Leavey