DTS Global Variables not working

  • I can't seem to get a global variable that I create in the design DTS Package to show up in my Active X tansformation script. The name of the variable is lastDate, type Date, and value of 1/1/2003. When I try calling the variable...like: MsgBox DTSGlobalVariables("lastDate").value it is empty. What am I doing wrong? Thanks for any help.

    Oh, I am using sql server 7

    -Shane Trotter

  • Can you post your ActiveX code, please? It seems like it should work the way you have it but it is difficult to tell without seeing the code. Maybe try MsgBox CStr(DTSGlobalVariables("lastDate").Value?

    Michael Weiss


    Michael Weiss

  • Sure, I can post my code. I tried to simplify it by making the variable a string, and initializing it with some text, but still nothing here is my code, i have most of it commented out for testing, just the msgbox is running.

    'Option Explicit

    Function Main()

    'dim rowDate

    'dim startDate

    'dim secondsDifference

    MsgBox DTSGlobalVariables("lastDate").value

    'rowDate = DTSSource("Col004") + " " + DTSSource("Col005")

    'DateValue( rowDate )

    'startDate = DTSGlobalVariables("date").value

    'secondsDifference = DateDiff( "s" , startDate, rowDate )

    'If secondsDifference > 0 then

    'DTSDestination("username") = DTSSource("Col001")

    'DTSDestination("program") = DTSSource("Col002")

    'DTSDestination("spool") = DTSSource("Col003")

    'DTSDestination("printdate") = startDate

    'DTSDestination("computer") = DTSSource("Col006")

    'DTSDestination("pages") = DTSSource("Col012")

    'DTSGlobalVariables("date").value = rowDate

    'Main = DTSTransformStat_OK

    'Else

    'Main = DTSTransformStat_SkipRow

    'End If

    End Function

    Thanks again for your help. It should work, and I can't figure out why it is not.

    -Shane Trotter

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply