Date Questions

D

Dimitris

Hello I would like to ask 2 questions:
1) The user enters a date in a field. The date mask is: 99/99/00;0;_ How
can 05 automaticaly be entered in the end since all dates refer to 2005 so
if there is a way not to enter the year but be there at the end of the date
as default.
2) The mask 99/99/00;0;_ must have day, month and year entered. But some
records do not have the day entered just month and year. What mask do I need
to allow me to enter the day if possible and not require it?

Thanks in advance
Dimitris
 
J

John Spencer

Date fields require that you have a day, a month, and a year. If you have
entries missing the day of the month, then you have to assign an arbitrary
(but valid) value or break the date field into three separate fields - a
month field, a year field and a day field.

You can use a text field to store a string in and then handle that whatever
way you want.

If you break the data into three fields, then you can assign a default value
to your year field (or associated controls). You will probably also want to
write some code that checks the three date parts and validates them as
making a "complete" date.

Month allows only values 1-12 or null
Day allows only values 1-31 (actually, this would be dependent on the month
value) or null
Year allows only value ?? to ?? or null
 
J

John Vinson

Hello I would like to ask 2 questions:
1) The user enters a date in a field. The date mask is: 99/99/00;0;_ How
can 05 automaticaly be entered in the end since all dates refer to 2005 so
if there is a way not to enter the year but be there at the end of the date
as default.

Just get rid of the date mask, and Access will fill in the year
automatically.
2) The mask 99/99/00;0;_ must have day, month and year entered. But some
records do not have the day entered just month and year. What mask do I need
to allow me to enter the day if possible and not require it?

There is no such mask. A Date/Time value is actually stored as a
number, a count of days and fractions of a day (times) since midnight,
December 30, 1899; "September 2005" isn't a date and cannot be stored
in a date/time field.

You might want to consider using three fields, for the year
(defaulting to Year(Date()), month and day; this would allow you to
fill in the available information, leaving the day (or even the month,
perhaps) unspecified if it is not known.

John W. Vinson[MVP]
 

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

Similar Threads


Top