Editing Data Entered Dates

For many, many years I have been using the 'Short Date' format for entry of dates on my Access Forms.  Trusting that my dates were solid.

We are now moving the Access MDB to SQL Server.  I got an error on one of my tables that had a date field.  SQL didn't like some of the dates in the date field of the table and cancelled the import.

I researched and found these dates: 2/15/104, 9/15/104, 3/1/112, 4/4/204 etc..  Of 111,000 records only 25 had dates with a year less than 1000. To test, I removed the records with those dates from the file and the import worked perfectly, building a SQL table.

 I realize that these are valid dates but certainly not correct for the intended purposes of the application.  Obviously using the 'Short Date' format is not preventing entry of some really bad years.  

What are you all using to make sure only valid dates get into the DB?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In table design, validation rule, enter the lowest acceptable date. Like:



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeOwner, Developing Solutions LLCCommented:
as you said, those are valid dates, and data entry would normally allow those.

I generally use the Form_BeforeUpdate event of my forms to test for "valid" entries in my forms.  for dates, I simply check to see whether the date is within a valid range for the type of date.   For DOB, I generally use:

Year([DOB]) > YEAR(Date()) - 100

but even that would cause an error if someone was being entered into the database who was over 100 years old.

The Form_BeforeUpdate event includes a Cancel argument, which will prevent the record from being saved if you set that value to True.
mlcktmguyAuthor Commented:
Thanks for the ideas
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.