Custom format Date/Time field not working

S

S-Ben

Hi

I have a field in a table of type Date/Time. All I want is a value for year
in that field, so I have created a custom format of yyyy.

When I try inputting values in that field such as 1999, a dialog pops up
saying the value entered isn't valid for this field.

I also had an input mask of 9999;0; and at first I thought that this was the
reason that the problem was occuring, but after removing it, I am still
getting the error dialog.

It is quite annoying because I cannot see where I have gone wrong in the
table design.
 
O

Ofer

If all you want to store in this field is the year, and not all the date,
then change the field type from Date/Time to number, there is no need for the
date time type.
That way you wont get an error while storing the year only.
 
F

fredg

Hi

I have a field in a table of type Date/Time. All I want is a value for year
in that field, so I have created a custom format of yyyy.

When I try inputting values in that field such as 1999, a dialog pops up
saying the value entered isn't valid for this field.

I also had an input mask of 9999;0; and at first I thought that this was the
reason that the problem was occuring, but after removing it, I am still
getting the error dialog.

It is quite annoying because I cannot see where I have gone wrong in the
table design.

The reason for that error is that 1999 is not a valid date.
A valid date consists of a Month, Day, and Year.

If all you want is the year, change the field datatype to Text or
Number. If you do have a valid date and want to display just the year,
then set the Format property of the field to
yyyy.
 
Top