Is there a way to call a function that is saved in a common database, say in a shared folder?
I have (inherited)a DueDate(NumOfDays) function which I use to add a code determined number of days to a date field by way of a query, sometimes 30,000 lines. This function takes into account holidays, shutdown days etc and then makes sure the due date does not end on the weekend.
I have included the code just for reference to visualize what a PAIN it is to try and maintain this everywhere!
This all works fine, however....
The problem is that the function is utilzied company wide in MANY databases and when maintenance is needed I have to hunt down all the occurances and fix the function.
Is there a way to call a function that is saved in a common database, say in a shared folder?
Thank you for any insight.
I have (inherited)a DueDate(NumOfDays) function which I use to add a code determined number of days to a date field by way of a query, sometimes 30,000 lines. This function takes into account holidays, shutdown days etc and then makes sure the due date does not end on the weekend.
I have included the code just for reference to visualize what a PAIN it is to try and maintain this everywhere!
Code:
Public Function AddDays(ByRef MaxReleaseDate As Date) As Date
On Error GoTo Err_PlanDates
Dim tmpDate As Date
Dim num As Integer
num = 0
tmpDate = CDate(MaxReleaseDate)
Do While num < 30 '30 calendar days
tmpDate = DateAdd("y", 1, tmpDate)
If (tmpDate = "1/21/2008" Or tmpDate = "3/21/2008" Or _
tmpDate = "5/26/2008" Or tmpDate = "1/1/2008" Or _
tmpDate = "7/4/2008" Or tmpDate = "9/1/2008" Or _
tmpDate = "11/22/2007" Or tmpDate = "11/23/2007" Or _
tmpDate = "12/24/2007" Or tmpDate = "12/25/2007" Or _
tmpDate = "12/26/2007" Or tmpDate = "12/27/2007" Or _
tmpDate = "12/28/2007" Or tmpDate = "12/29/2007" Or _
tmpDate = "12/30/2007" Or tmpDate = "12/31/2007") Then
Else
num = num + 1
End If
Loop
Do While (WeekDay(tmpDate) = 1 Or WeekDay(tmpDate) = 7 Or _
tmpDate = "1/21/2008" Or tmpDate = "3/21/2008" Or _
tmpDate = "5/26/2008" Or tmpDate = "1/1/2008" Or _
tmpDate = "7/4/2008" Or tmpDate = "9/1/2008" Or _
tmpDate = "11/22/2007" Or tmpDate = "11/23/2007" Or _
tmpDate = "12/24/2007" Or tmpDate = "12/25/2007" Or _
tmpDate = "12/26/2007" Or tmpDate = "12/27/2007" Or _
tmpDate = "12/28/2007" Or tmpDate = "12/29/2007" Or _
tmpDate = "12/30/2007" Or tmpDate = "12/31/2007")
tmpDate = DateAdd("y", 1, tmpDate)
num = num + 1
Loop
PlanDates = tmpDate
Exit_PlanDates:
Exit Function
Err_PlanDates:
MsgBox Err.Description
Resume Exit_PlanDates
End Function
This all works fine, however....
The problem is that the function is utilzied company wide in MANY databases and when maintenance is needed I have to hunt down all the occurances and fix the function.
Is there a way to call a function that is saved in a common database, say in a shared folder?
Thank you for any insight.