|
|
SynopsisTests the number of elapsed dates since a starting point to determine if the specified duration in days has elapsed CODE ' TesttemplateFL
' http://www.utteraccess.com/wiki/index.php/Sandbox:TesttemplateFL ' Code courtesy of UtterAccess Wiki ' Licensed under Creative Commons License ' http://creativecommons.org/licenses/by-sa/3.0/ ' ' You are free to use this code in any application, ' provided this notice is left unchanged. ' ' rev date brief descripton ' 1.0 2010-09-11 ' Public Function fGracePeriodValid(rdtStartDate As Date, _ riDuration As Integer) As Boolean ' Procedure: fGracePeriodValid ' DateTime: 09/11/2010 5:51:11 AM ' Description: tests the number of elapsed dates since a starting point ' to determine if the specified duration in days has elapsed '-- 'USEAGE ' ' rdtStartDate date on which the grace period started ' riDuration number of days allowed in the grace period' ' returns true if one or more days of the grace period have not elapsed ' false if the grace period has elapsed ' 'NOTE: if grace periods will be tested might exceed 32,767 days (~89 years) ' then a long variable should be used for the elapsed period calculation ' Const cstrProcedure = "fGracePeriodValid" Dim intElapsed As Integer Dim blnResult As Boolean On Error GoTo HandleError intElapsed = DateDiff("d", rdtStartDate, Date) If intElapsed <= riDuration Then blnResult = True Else blnResult = False End If HandleExit: fGracePeriodValid = blnResult Exit Function HandleError: Select Case Err Case 6 'overflow rdtStartDate is more then 32767 days before current date blnResult = False Case Else MsgBox "Error " & Err & "in " & cstrProcedure blnResult = False End Select Resume HandleExit End Function
|
| This page was last modified 20:23, 9 November 2010. This page has been accessed 578 times. Disclaimers |