How to use validation rule for allowing only first day of the month

D

doyle60

What can I put in the Validation Rule property of a date text box to
only allow the first day of the month to be entered? I tried
everything and googled and can't quite figure it out.

Also, what do I enter to allow for only the last day of the month? I
suppose it is the above minus one.

Thanks,

Matt
 
F

fredg

What can I put in the Validation Rule property of a date text box to
only allow the first day of the month to be entered? I tried
everything and googled and can't quite figure it out.

Also, what do I enter to allow for only the last day of the month? I
suppose it is the above minus one.

Thanks,

Matt

Regarding > I suppose it is the above minus one.<
If you SUBTRACT 1 day from the 1st day of the month, the last day of
the previous month could be a 28, 29, 30, or 31.
However, if you ADD 1 day to the entered date and it equals 1, then
you know you have entered the last day of that month.

First day of the entered month:
DatePart("d",[ThisFieldName])=1

Last day of entered month:
DatePart("d",[ThisFieldName]+1)=1
 
D

doyle60

Yes, thanks. I get it. If you gave me the first one only I probably
would have figured out the second one in time.

Matt
 

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