G
Guest
Hi
I am having a major diffuclty with this: Look at this formula:
Month Calculation
=(((DateDiff("d",[receiveddate],IIf(IsNull([outdate]),Date(),
outdate])))<1),1,(DateDiff("m",[receiveddate],IIf(IsNull
([outdate]),Date(),[outdate]))))
This formula calcualtes the date difference between the 'received date' and
the 'ship date' if the 'ship date is blank' then the 'current date', then it
tells me how many months have gone by. If the month value is less than one
month, it automatically sets it to one. The problem I am having is this, I
need this formula to calculate a new month, as soon as 30 days have gone by.
For example, if the 'received date' is January 15, 2006 and the 'ship date'
was February 20, 2006, the way the formula is now, it will show me (1) month,
when in actuality should be (2), since the total of days is 37 days. That
means that when the 'current date' was February 14, 2006 it should
automatically changed to (2). Can you modify the formula above to do what I
have described here.
Since then, I have created a new formula:
Public Function MthsElapsed(dteRecDate As Date, dteOutDate As Date)
as Integer
If IsNull(dteOutDate) Then
dteOutDate = Date()
End If
MthsElapsed = DateDiff("m",dteRecDate,dteOutDate)
If Day(dteOutDate) > Day(dteRecDate) Then
MthsElapsed = MthsElapsed + 1
End If
End Function
This formula works half way. First, the line that reads 'dteOutDate =
Date()' everytime I tried typing the () and I hit enter to input the next
line of code, the parenthesis disappear. So the line ends up looking like
this:dteOutDate = Date
When I am finished with the code, I go into the actual form, after I have
changed the source to read =mthsElapsed([receiveddate],[outdate]), and I get
an ERROR in the area where the total months should dbe displayed. What I did
noticed was that if the Out Date has an actual date, it will go ahead and
calculate the months and display it correctly. But if the Out Date is Blank
it will give me an error, instead of doing the calculation based on the
actual date, since the customer calls and asks 'what are my current charges',
then the computer needs to be able to check the current date against the
received date and display the number of months to date, just like it is doing
with the out date.
Any help is greatly appreciated.
I am having a major diffuclty with this: Look at this formula:
Month Calculation
=(((DateDiff("d",[receiveddate],IIf(IsNull([outdate]),Date(),
outdate])))<1),1,(DateDiff("m",[receiveddate],IIf(IsNull
([outdate]),Date(),[outdate]))))
This formula calcualtes the date difference between the 'received date' and
the 'ship date' if the 'ship date is blank' then the 'current date', then it
tells me how many months have gone by. If the month value is less than one
month, it automatically sets it to one. The problem I am having is this, I
need this formula to calculate a new month, as soon as 30 days have gone by.
For example, if the 'received date' is January 15, 2006 and the 'ship date'
was February 20, 2006, the way the formula is now, it will show me (1) month,
when in actuality should be (2), since the total of days is 37 days. That
means that when the 'current date' was February 14, 2006 it should
automatically changed to (2). Can you modify the formula above to do what I
have described here.
Since then, I have created a new formula:
Public Function MthsElapsed(dteRecDate As Date, dteOutDate As Date)
as Integer
If IsNull(dteOutDate) Then
dteOutDate = Date()
End If
MthsElapsed = DateDiff("m",dteRecDate,dteOutDate)
If Day(dteOutDate) > Day(dteRecDate) Then
MthsElapsed = MthsElapsed + 1
End If
End Function
This formula works half way. First, the line that reads 'dteOutDate =
Date()' everytime I tried typing the () and I hit enter to input the next
line of code, the parenthesis disappear. So the line ends up looking like
this:dteOutDate = Date
When I am finished with the code, I go into the actual form, after I have
changed the source to read =mthsElapsed([receiveddate],[outdate]), and I get
an ERROR in the area where the total months should dbe displayed. What I did
noticed was that if the Out Date has an actual date, it will go ahead and
calculate the months and display it correctly. But if the Out Date is Blank
it will give me an error, instead of doing the calculation based on the
actual date, since the customer calls and asks 'what are my current charges',
then the computer needs to be able to check the current date against the
received date and display the number of months to date, just like it is doing
with the out date.
Any help is greatly appreciated.