|
 |
access thread: Date/Day validation
Message #1 by "Peter F Pennells" <ppenn@b...> on Fri, 27 Jul 2001 22:17:52 +0100
|
|
I have a form in which employees activities throughout a week are emtered
for absentee monitoring
The date entered has to be a Sunday date so that queries can look at a week
with a specific weekend date (Sunday)
I have found that people sometimes enter a Friday day which of course
prohibits the query from showing all the entries
Is it possible to validate the text box so that it will only accept a Date
which is a Sunday
I have been looking at Dayof the week function but so far have not come up
with an answer
Thank you in anticipation
Peter
Message #2 by "Richard Lobel" <richard@a...> on Fri, 27 Jul 2001 14:27:14 -0700
|
|
Peter,
There is a Weekday() function which returns an integer from 1 to 7.
Sunday is 1. So you can check the date the user puts in against this and
respond accordingly.
If Weekday(Text1box) = 1 then
DoWhatever
Else
msgbox "You entered a non-Sunday date. Try again."
End If
Hope this helps.
Richard Lobel
Message #3 by "Pardee, Roy E" <roy.e.pardee@l...> on Fri, 27 Jul 2001 14:25:41 -0700
|
|
Very doable--have a look at the Weekday function in Help. You may be able
to get away with typing an expression right into the ValidationRule
property. If not, write a custom VBA function that returns true/false and
set the ValidationRule to
=MyFunction(DateFieldName)
HTH,
-Roy
-----Original Message-----
From: Peter F Pennells [mailto:ppenn@b...]
Sent: Friday, July 27, 2001 2:18 PM
To: Access
Subject: [access] Date/Day validation
I have a form in which employees activities throughout a week are emtered
for absentee monitoring
The date entered has to be a Sunday date so that queries can look at a week
with a specific weekend date (Sunday)
I have found that people sometimes enter a Friday day which of course
prohibits the query from showing all the entries
Is it possible to validate the text box so that it will only accept a Date
which is a Sunday
I have been looking at Dayof the week function but so far have not come up
with an answer
Thank you in anticipation
Peter
|
|
 |