Due Date Based on Purchase Date (1 Viewer)

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
Hello Geniuses!

I have a "Purchase Date" field and a "Due Date" field.

I need the "Due Date" field to auto populate +7 working days excluding the weekend.

How would I accomplish this?

Thank you
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:19
Joined
Oct 29, 2018
Messages
21,467
Hi. One way is to use the fAddWorkdays() custom function. For example:
Code:
Me.DueDate=fAddWorkdays(7,Me.PurchaseDate)
(I could be wrong with the syntax.)
 

Mark_

Longboard on the internet
Local time
Yesterday, 17:19
Joined
Sep 12, 2017
Messages
2,111
Very important questions; will you need to deal with holidays?; When does the "Next day" start?; How often will data be entered that should actually be considered as "On the next day?"; Can the due date be changed after it is created?

Working with due dates can become very messy if you don't find all the conditions that can affect it. This is very important when you start seeing data put in after "business hours" that is expected to be dealt with one day later than your program expects or "needs to be adjusted" based on other criteria.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:19
Joined
Oct 29, 2018
Messages
21,467
For example, in the AfterUpdate event of Purchase Date.
 

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
Hello,

The due date is an "estimate" only.

Example: Purchase Date Monday 11/4/19
Due Date would be 11/13/19, not including weekends on a basic Mon - Fri work week.

Holidays may offset this date, but since it is an estimate I think it would be acceptable. I am looking for a general date to be expecting the delivery of the item.
 

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
I entered the code

Me.DueDate=fAddWorkdays(7,Me.PurchaseDate)

In the AfterUpdate event of Purchase Date and its not working?
 

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
Any suggestions/help?

Thank you very much everyone!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:19
Joined
Oct 29, 2018
Messages
21,467
I entered the code

Me.DueDate=fAddWorkdays(7,Me.PurchaseDate)

In the AfterUpdate event of Purchase Date and its not working?
First, did you download the file from the link I posted?
 

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
Yes I have it, please forgive my ignorance but I was not sure where to copy/paste the content. Would it be under Module?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:19
Joined
Oct 29, 2018
Messages
21,467
Yes I have it, please forgive my ignorance but I was not sure where to copy/paste the content. Would it be under Module?
Yes, and make sure you leave the name as Module1 (or something similar). Also, please double check the syntax. I wasn't sure if the number comes first or later. Let us know how it goes.
 

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
Ok, I did as instructed and copied the material under Module 1.

I entered:

Me.DueDate=fAddWorkdays(7,Me.PurchaseDate) in the AfterUpdate event of Purchase Date.

When I entered 11/4/19 under Purchase Date, the Due Date says 10/20/2067.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:19
Joined
Oct 29, 2018
Messages
21,467
Ok, I did as instructed and copied the material under Module 1.

I entered:

Me.DueDate=fAddWorkdays(7,Me.PurchaseDate) in the AfterUpdate event of Purchase Date.

When I entered 11/4/19 under Purchase Date, the Due Date says 10/20/2067.
Hi. Did you verify the syntax like I said? I don't have a copy of the file to verify for you. Can you maybe post the function declaration?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:19
Joined
Oct 29, 2018
Messages
21,467
Okay. I downloaded the file to check the required syntax. I had it backwards. Try it this way.
Code:
Me.DueDate=fAddWorkdays(Me.PurchaseDate,7)
 

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
Is the function declaration the content in Module 1?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:19
Joined
Oct 29, 2018
Messages
21,467
Is the function declaration the content in Module 1?
Hi. I had it backwards. Try the new syntax I just posted above and let us know what happens.
 

vcarrill

Registered User.
Local time
Yesterday, 18:19
Joined
Aug 22, 2019
Messages
60
You Sir are a Master Mind!!!

Thank you very much!
 

Users who are viewing this thread

Top Bottom