Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21271

[RESOLVED] help on function to return with decimals

$
0
0
I have this function

Public Function GetIntervalWeeks(mycriteria As Integer) As Long
Dim a As Date
Dim b As Date
a = Format(GetLastRequestDate(mycriteria), "mm/dd/yyyy")
b = Format(GetLastDeliveryDate(mycriteria), "mm/dd/yyyy")
GetIntervalWeeks = DateDiff("d", b, a)
GetIntervalWeeks = GetIntervalWeeks / 7
End Function

like if I have the value of 5 for the difference of A and B and I will performing division of 5/7 then my function results to 1 instead of 0.7142857142857143.

How will I make it to decimal format and not rounded off.


EDITED: OK I changed the function data type to double or currency and it changed the result to decimal. But is there any other solution?

Viewing all articles
Browse latest Browse all 21271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>