Day Validation code

R

rama

Hello,

I am looking for some help for my data entry form. In the form there
is a combo box, which is used to enter date ("cboLongDate"). The date
format is "Wednesday, June 13, 2007" . I need to confirm the day is
Wednesday or not before the user click on add data or close form. The
important thing is day (ie "Wednesday") not the date as Wednesday
comes every week. If the selected day is not "wednesday" a message box
should pop up saying the day selected is incorrect while closing or
adding data so that user can get a chance to correct it.
Thanks in advance
Rama
 
A

Allen Browne

Use the BeforeUpdate event procedure of the combo.

Test if WeekDay([cboLongDate]) is 4.

Cancel the event if you want to force the user to enter a different value.
 

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