csmedsrc Posted April 3, 2009 Posted April 3, 2009 I have a database where the user chooses the week beginning on a Monday from a drop down calendar. There are other fields that then calculate the date for the other days of the week. So if they choose Monday 4-1: Tuesday 4-2, Wednesday 4-3, etc. is automatically generated. I'm trying to write a validation calculation that ensures that the date the user selects from the drop down calendar is a Monday. I'm not very familiar with the date functions so any help would be appreciated.
comment Posted April 3, 2009 Posted April 3, 2009 Well, you could validate by a calculation = DayOfWeek ( SelectedDate ) = 2 But why not let them choose any day, then calculate the days in the week of the selected date? For example: Sun = SelectedDate - DayOfWeek ( SelectedDate ) + 1 ; Mon = SelectedDate - DayOfWeek ( SelectedDate ) + 2 ; etc. Note that this example assumes week starts on Sunday.
csmedsrc Posted April 3, 2009 Author Posted April 3, 2009 It is setup that way because that is the way HR wants it and it is not worth arguing with them over. I tried that calculation but it doesn't prevent you from choosing a non Monday and does not display my warning message when the user chooses a non Monday. The field type is set to date, I'm not sure why it's not working.
csmedsrc Posted April 3, 2009 Author Posted April 3, 2009 Yes, it is set to validated by calculation.
comment Posted April 3, 2009 Posted April 3, 2009 I don't know why it doesn't work for you, then. I hope you realize that validation by calculation occurs at record commit only.
csmedsrc Posted April 3, 2009 Author Posted April 3, 2009 Actually I didn't know that. It does work, you just need to click outside the field first. Sorry, still a newb at this stuff.
Recommended Posts
This topic is 5807 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now