Actually your makeUSDate function is working differently than you think
From the Immediate window
Code:
?makeUSDate(#11/01/2020#)
11/1/2020
?makeUSDate(#15/01/2020#)
1/15/2020
I've slightly modified your GetDiff function and it now works (despite the above results):
Code:
Public Function GetDiff(xDate As Date, yDate As Date) As Integer
xDate = makeUSDate(xDate)
yDate = makeUSDate(yDate)
GetDiff = DateDiff("d", xDate, yDate)
End Function
Example results:
Code:
?GetDiff(#11/01/2020#, #15/01/2020#)
4
?GetDiff(#11/01/2020#, #05/02/2020#)
25
?GetDiff(#02/01/2020#, #30/04/2020#)
119
Or of course you can just do this:
Code:
DateDiff("d", Format(StartDate, "mm/dd/yyyy"), Format(EndDate, "mm/dd/yyyy"))