How to create custom Input Mask date msgbox when none date value is entered in date field

I want a custom message that inform the user that wrong data type is entered in "date field" , Instead of the default message that says
"The value you entered isn't appropriate for the input mask  ..... specified for this field"


Who is Participating?
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.

Rey Obrero (Capricorn1)Commented:
you can use the On Error event of the form to create the custom message

Private Sub Form_Error(DataErr As Integer, Response As Integer)
    if Dataerr=2279 then
         msgbox "Your message here
    end if
     response = acDataErrContinue
End Sub

you can add more custom message by trapping different type of error with

select case dataerr
    case 2279
            'your custom message
    case  3314
             'your custom message
    case else

end select

for list of errors see this link
I don't ever use input masks for date fields.
1. they prevent the use of the calendar popup
2. they don't ensure that the user entered a valid date
3. they require you to enter a minimum of 6 characters, 8 if you are using a 4 digit year.

I do use input masks for other types of data, just not for dates.  I like my user to be able to enter 3/14 and have the year default.

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
SlimfitAuthor Commented:
Very helpful
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.