Jump to content

This topic is 5807 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.