Input Mask without Year for date

2019-09-05 15:06发布

问题:

Could anyone help me in inserting a input mask formula for date in a access form textbox

that shouldnot take year

which only take date and month in the below format :

DD/MM

Not in DD/MM/YY

Thanks for help in advance

回答1:

99/99 would work.



回答2:

I'd suggest that you probably shouldn't use a date mask like this with data stored in a date field.

If you input like "06/13" that will be stored as 06/13/2009 today and as 6/13/2010 a year from now. That is, all entry that doesn't specify a year will be stored as the current year. To use the resulting data, you'll always have to strip off the year, as it won't mean anything otherwise.

Thus you'll be always parsing with Format() or use Month() and Day() and that means any indexes on the field will be of no use. If you're going to have to do that, you really don't get much benefit from using a date field, and should consider storing the data as a literal string (suitably validated), or using two fields to store the month and day (again, suitably validated).