Hello,
I need to pass the lastworkdate parameter to a DTS job. I have searched and attempted to create the activex task to accomplish this using VB script. This is the script I use. By the way, I've never coded in VB script, so I will not feel bad if you tell me I am totally off track.
HELP!!!
Dim Workdate
Dim RunDate
Dim dateOK
Dim dateHoliday
' Set the rundate to todays date minus 1 '
RunDate = DateAdd(d,-1,Now)
' Check to see if the new rundate is a weekend or holiday date'
checkWeekendDate(RunDate)
checkHoliday(RunDate, dateHoliday)
' If it was a holiday, check to see if it was changed to a weekend day'
If dateHoliday = "y"
checkWeekendDate(RunDate)
End If
Function checkWeekendDate
Select Case WeekDay(Rundate)
' Check if Sunday '
Case 1
RunDate = DateAdd(d, -3 RunDate)
' Check if Saturday '
Case 7
RunDate = DateAdd(d, -2, RunDate)
End Select
End Function
Function checkHoliday()
Select Case RunDate
' Check if Memorial Day, 4th of July, Labor Day, Thanksgiving,
Christmas or New Years Day '
Case 05/29/2006, 07/04/2006, 09/04/2006, 11/23/2006,
12/25/2006, 01/01/2007
RunDate = DateAdd(d, -1, Rundate)
dateHoliday = "y"
' Check if Day after Thanksgiving '
Case 11/24/2006
RunDate = DateAdd(d, -2, Rundate)
dateHoliday = "y"
Case Else
dateHoliday = "n"
End select
End Function