Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

Date scheduling

I have a form with the following fields:

Date of Last Visit (date field) named "txtDateOfPreviousVisit"
Visit Start Date (date field) named "txtStartDate"
Visit Frequency (number field) named "txtVisitFrequency"
Day of Week (number field) named "txtDayOfWeek"

When the form opens I want "txtStartDate" to populate with "txtDateOfPreviousVisit" + "txtVisitFrequency""

BUT...

If "txtDayOfWeek" is for example, 3 (which is Tuesday) then the "txtStartDate" has to be a Tuesday also but never past the "txtVisitFrequency" value.

If the date doesn't land on that day of the week then it has to be the correct day of the week prior to "txtDateOfPreviousVisit" + "txtVisitFrequency".

In other words, for example, if txtDateOfPreviousVisit is 12/9/2014 and txtDayOfWeek is 3 (Tuesday), and txtVisitFrequency is 90 then txtStartDate has to be 3/3/2015, not 3/9/2014 because that is a Monday.

Very complicated I know.  I sure hope someone can help.
ASKER CERTIFIED SOLUTION
Avatar of chaau
chaau
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SteveL13

ASKER

Perfect.  Thank you very much.