calculation error

I follow how the code is setup and what it is looking for, but I can not seem to make the necessary changes.

Me.[TAT] = get_Weekdays([Due_Date] - [Result_Date], 0) is looking for dates, where did they get changed to integers? Thanks for all your help :).
 
They didn't get changed to integers, you submitted integers:

get_Weekdays([Due_Date] - [Result_Date], 0)

[Due_Date] - [Result_Date] is an integer
0 is an integer

You are passing get_Weekdays 2 integers and it expects 2 dates. I don't know how to explain it better than that.
 
I follow why the function is not working, I just don't know how to fix it. Sorry, I am a scientist trying to learn programming. Thanks :).

Code:
 get_Weekdays([Due_Date] - [Result_Date], 0)

If Due_Date is 9/29/2014
Result-Date is 10/1/2014

Then 9/29/2014 - 10/1/2014 = -2
 
If Due_Date is 9/29/2014
Result-Date is 10/1/2014

Then 9/29/2014 - 10/1/2014 = -2

What does that have to do with anything?

The function isn't broken, the way you are using it is. Maybe a science metaphor then:

Suppose you have a machine that creates water by bonding its underlying parts. There's a spout to put in hydrogen and a spout to put in oxygen. You are coming along and pouring water in those spouts and can't figure out whay the machine is making hydrogen peroxide and ozone. The machine isn't broke, what you are putting into it is.

You aren't pouring the correct inputs into the spouts of your function. Pass it 2 dates:

get_Weekdays("9/22/2014", "9/30/2014")
 
Last edited:
get_Weekdays(#9/22/2014#, #9/30/2014#)
I am sure Plog knows this but you need # around dates not ".

Like plog said... LOOK at the function CLOSELY!

get_Weekdays(pstart As Date, pend As Date)
It requires 2 inputs, that much you seem to have understood.
However it requires 2 DATES, a start date and an end date...
 

Users who are viewing this thread

Back
Top Bottom