Null date field

S

swtrader

I've read a long discourse which details a problem similar to mine but
I'm still confused.

Given: a date field in my table and on a form. When the record is
first created, the date field is Null (correct?) or is it Empty?

In any event, if a user enters a date in the field (on the form) and
then determines that there should be no date (because the date really
was for an adjacent record or somesuch), attempting to 'clear' the date
(by entering the SPACE bar, for example) results in an error message:
"Idiot, you have to enter something in the date format "nn/nn/nnnn".

There is no 'correct' date to enter since there is no date (a check
hasn't been received yet, for example) so forcing 'some' date into the
field doesn't work.

I would like to be able to set a Double-click event that would re-set
the field to Empty or Null.

????
 
A

Allen Browne

If the record is created without a date, the value is Null.

If you enter a date, and then use backspace to remove the date, the value
becomes Null again.

Entering a space is not the same thing as entering a value, and could
trigger an error message that spaces are not the correct data type.

The error message you reported is not the standard one, so perhaps there is
something in the Validation Text property, or in the BeforeUpdate event of
the control the Error event of the form to give the custom message.

There may also be something in the Input Mask property, which is frustrating
and does nothing useful for dates.

If you wanted to programmatically assign the Null value to the control named
MyDate, the code would be:
Me.[MyDate] = Null
If there is already a half-entered date in the control, you may have to
clear the entry (by pressing Esc) before that would work.
 
F

fredg

I've read a long discourse which details a problem similar to mine but
I'm still confused.

Given: a date field in my table and on a form. When the record is
first created, the date field is Null (correct?) or is it Empty?

In any event, if a user enters a date in the field (on the form) and
then determines that there should be no date (because the date really
was for an adjacent record or somesuch), attempting to 'clear' the date
(by entering the SPACE bar, for example) results in an error message:
"Idiot, you have to enter something in the date format "nn/nn/nnnn".

There is no 'correct' date to enter since there is no date (a check
hasn't been received yet, for example) so forcing 'some' date into the
field doesn't work.

I would like to be able to set a Double-click event that would re-set
the field to Empty or Null.

????

f you 'clear' the field using the space bar you haven't cleared the
field. You have entered a space, which is not a valid date entry.

Delete the incorrect entry using the delete key or the back space key,
depending upon where in the field the cursor is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top