I have a SQL Server 2000 DTS pkg that executes a child pkg programmically via an ActiveX task (this is so I can set values in the child and gather return values from the child pkg).

The code looks something like this:

option explicit
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

Dim oPkg
Dim rval
Dim sServer, sUID, sPWD, iSecurity , sPkgPWD, sPkgName, sErrMsg
Set oPkg = CreateObject("DTS.Package")

' Run child process DTS manually

' Assign parameters
sServer = "(local)"
sUID = ""
sPWD = ""
iSecurity = DTSSQLStgFlag_UseTrustedConnection
sPkgPWD = ""
sPkgName = "Forecast Model Load"

' Load Child Package
oPkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity , sPkgPWD, "", "", sPkgName

' set outer global variables
oPkg.GlobalVariables("CVar").Value = DTSGlobalVariables("PVar").Value

On Error Resume Next

' Execute the Package

if Err.Number <> 0 then

rval = 1


' Pass a child value or variable back to the parent
if oPkg.GlobalVariables("Completion_Status").Value = true then
rval = 0

rval = 2

end if

end if

DTSGlobalVariables("Execute_Status").Value = rval

' Clean Up
Set oPkg = Nothing

if rval = 0 then
Main = DTSTaskExecResult_Success
Main = DTSTaskExecResult_Failure
end if

End Function

To explain a little further, I want to set a parent pkg DTSGlobalVariable "Execute_Status" based on the execution of the child package where:
- rval = 1 where fatal error caught by error handling.
- rval = 0 or 2 which are based on the return value from the child pkg.

Now, everything is fine until after some testing I have found that the process can't set DTSGlobalVariables("Execute_Status").Value in the case where a fatal error occurs on oPkg.Execute. The wierd thing is the local variable rval gets correctly set so the error handling works fine, but when I try to set DTSGlobalVariables("Execute_Status").Value = rval nothing happens. When I put a check before and after the line DTSGlobalVariables("Execute_Status").Value = rval, DTSGlobalVariables("Execute_Status").Value is empty.
Weirder still is that I have tried setting DTSGlobalVariables("Execute_Status").Value = 2 in a step before this step and when I check the value of this variable in steps immediately before and after this step the value is still 2, even afterwards. It's as though this code can't access DTSGlobalVariables after a fatal error has occurred, even if it is handled.
The problem I need to use this flag in later steps to interpret mutliple ways of 'failure'.

Any ideas?