Default Field

J

jlo

I have a field called Priority.

If the priority is high, I want to reflect today's date in a field called
Due Date.
If the priority is Medium, I want to reflect the next working day in the
field Due Date.
If the priority is Low, I want to reflect two working days in the Due Date
field.

Another twist, can this be done excluding weekends and holidays? If not,
that's OK.
 
M

Marshall Barton

jlo said:
I have a field called Priority.

If the priority is high, I want to reflect today's date in a field called
Due Date.
If the priority is Medium, I want to reflect the next working day in the
field Due Date.
If the priority is Low, I want to reflect two working days in the Due Date
field.

Another twist, can this be done excluding weekends and holidays?


Dim dtDue As Date
dtDue = Date + Switch(Me.Priority="High",0, _
Me.Priority="Medium",1, Me.Priority="Low",2)
Me.[Due Date] = dtDue + IIf(WeekDay(dtDue, 7) <= 2, _
2 - WeekDay(dtDue, 7), 0)
 
J

jlo

Thank you Marshall, works perfectly!

Marshall Barton said:
jlo said:
I have a field called Priority.

If the priority is high, I want to reflect today's date in a field called
Due Date.
If the priority is Medium, I want to reflect the next working day in the
field Due Date.
If the priority is Low, I want to reflect two working days in the Due Date
field.

Another twist, can this be done excluding weekends and holidays?


Dim dtDue As Date
dtDue = Date + Switch(Me.Priority="High",0, _
Me.Priority="Medium",1, Me.Priority="Low",2)
Me.[Due Date] = dtDue + IIf(WeekDay(dtDue, 7) <= 2, _
2 - WeekDay(dtDue, 7), 0)
 

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