VB code to require entry of date in specific format

T

transcriptlady

Is there a way to force a user to enter a date in a specific format, i.e.
MM/dd/yyyy in a protected cell in a table on a form? I have formatted the
form field the way I would like it to appear, but it does not force the user
to put it in that form. In other words, it still allows them to put the date
in whatever format they wish. I would like it to indicate to them when they
press <Enter> that they have entered the date in the wrong format and show
them the correct format. Please help!
 
J

Jay Freedman

transcriptlady said:
Is there a way to force a user to enter a date in a specific format,
i.e. MM/dd/yyyy in a protected cell in a table on a form? I have
formatted the form field the way I would like it to appear, but it
does not force the user to put it in that form. In other words, it
still allows them to put the date in whatever format they wish. I
would like it to indicate to them when they press <Enter> that they
have entered the date in the wrong format and show them the correct
format. Please help!

See http://www.word.mvps.org/FAQs/TblsFldsFms/ValidateFFields.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

Jay Freedman

transcriptlady said:
Is there a way to force a user to enter a date in a specific format,
i.e. MM/dd/yyyy in a protected cell in a table on a form? I have
formatted the form field the way I would like it to appear, but it
does not force the user to put it in that form. In other words, it
still allows them to put the date in whatever format they wish. I
would like it to indicate to them when they press <Enter> that they
have entered the date in the wrong format and show them the correct
format. Please help!

In addition to my previous answer, you may want to look at
http://www.gmayor.com/popup_calendar.htm where you can see how to let the
user click a calendar to pick a date. The macro code can then place the date
into the form field in whatever format you want (by using the proper pattern
in the Format statement).

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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