Date entry problem

S

Susanne

I have a field I want to defalt to the current year. It is going to be part
of a file name. All I want is the year (2008, 2009). I am currently using
the Now() function to default that value and then using format to show only
the year. The problem then arises when the focus is set to that field and I
get the entire date and time. Then, when I need to use that field to match
related files, I also get the entire date instead of just the year. I have
tried changing the Data Type from Date/Time to Number to Text. I can't seem
to get it.

Does anyone know how to do this? What am I missing?

Thanks so much in advance!
 
R

Rick Brandt

Susanne said:
I have a field I want to defalt to the current year. It is going to
be part of a file name. All I want is the year (2008, 2009). I am
currently using the Now() function to default that value and then
using format to show only the year. The problem then arises when the
focus is set to that field and I get the entire date and time. Then,
when I need to use that field to match related files, I also get the
entire date instead of just the year. I have tried changing the Data
Type from Date/Time to Number to Text. I can't seem to get it.

Does anyone know how to do this? What am I missing?

Thanks so much in advance!

Change the DataType to Number (Integer).

Change the default value to =Year(Date())
 
M

Mr B

Susanne,

Try using:

=Year(Now())

or

=Year(Date)

This will return on the year of the current date
 
S

Susanne

Thanks so much the both of you!!! It's working!! The funny thing is, with
the format set to yyyy, I was getting 1905 as the year, once I removed it, it
gives the current year! I tried these words previously, opposite positions,
therefore I received error messages. It's been a few years so I didn't
remember. Thanks again!
 
R

Rick Brandt

Susanne said:
Thanks so much the both of you!!! It's working!! The funny thing
is, with the format set to yyyy, I was getting 1905 as the year, once
I removed it, it gives the current year! I tried these words
previously, opposite positions, therefore I received error messages.
It's been a few years so I didn't remember. Thanks again!

Did you change the DataType ? Dates are stored internally as numbers. If
you store the numeric value 2009 into a Date field it will evaluate to the
date that is 2009 days after 12/30/1899 (which is 7/1/1905).
 
S

Susanne

Yes I did. Thanks.

Rick Brandt said:
Did you change the DataType ? Dates are stored internally as numbers. If
you store the numeric value 2009 into a Date field it will evaluate to the
date that is 2009 days after 12/30/1899 (which is 7/1/1905).
 

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