×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

DateAdd Function adding only business days
2

DateAdd Function adding only business days

DateAdd Function adding only business days

(OP)
Hi,
I thought that the following would only add 10 to the week days (business days M-F) but it is adding 10 days including weekends. Is there another way, easy way? I've seen a lot of coding examples but I thought there would be an interval setting that could be used?
Here's my example:
DateAdd("w",10,[tbl_Item_Detail_Calcs]![Item_Setup_Clock_Start])
Thanks!

RE: DateAdd Function adding only business days

With 10 days you'll always have a weekend in there, possibly 2. I'd write a switch function based on the day of the week that you're starting with.
Switch(format("ddd",[tbl_Item_Detail_Calcs]![Item_Setup_Clock_Start]) = "Sat", DateAdd("w",14,[tbl_Item_Detail_Calcs]![Item_Setup_Clock_Start]),
format("ddd",[tbl_Item_Detail_Calcs]![Item_Setup_Clock_Start]) = "Sun", DateAdd("w",13,[tbl_Item_Detail_Calcs]![Item_Setup_Clock_Start]), format("ddd",[tbl_Item_Detail_Calcs]![Item_Setup_Clock_Start]) = "Mon", DateAdd("w",12,[tbl_Item_Detail_Calcs]![Item_Setup_Clock_Start]), etc.)
I hope that helps.

RE: DateAdd Function adding only business days

You could use a Function from here to calculate business days M-F.

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.

RE: DateAdd Function adding only business days

(OP)
Thanks Andrzejek! At first I wasn't sure what "TheDate" represented but it works like a charm!
And Laurie, I had never used the Switch function so thanks for teaching me that!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close