I have copied an ActiveX Script into my DTS and I'm having trouble debugging it.
I am building a DTS package to check to see if todays file exists -- and if not, wait for 20 minutes and loop until it exists. This portion I am working with is simply to find whether it exists or not.
For reference, I have another ActiveX script changing Connection 1 (the text file for import) filename -- depending on today's date -- and it works fine.
My MsgBox's in the following code come out correctly - depending on whether the file exists or not -- but the script itself fails with the error "Invalid Task Result value"....
I am still using SQL 7.0
<code>
Option Explicit
Function Main()
Dim oFSO, oConn, sFileName, oFile
' Get the filename from my Text File connection called "Text File (Source)"
Set oConn = DTSGlobalVariables.Parent.Connections("Connection 1"
sFilename = oConn.DataSource
Set oConn = Nothing
Set oFSO = CreateObject("Scripting.FileSystemObject"
MsgBox sFileName
' Check File Exists first
If Not oFSO.FileExists(sFilename) Then
MsgBox "Failure"
' Return Error
' Main = DTSTaskExecResult_Failure
Else
' Get file object
Set oFile = oFSO.GetFile(sFilename)
MsgBox "Success"
End If
' Set oFile = Nothing
' Set oFSO = Nothing
End Function
</code>
Ideas appreciated.
I am building a DTS package to check to see if todays file exists -- and if not, wait for 20 minutes and loop until it exists. This portion I am working with is simply to find whether it exists or not.
For reference, I have another ActiveX script changing Connection 1 (the text file for import) filename -- depending on today's date -- and it works fine.
My MsgBox's in the following code come out correctly - depending on whether the file exists or not -- but the script itself fails with the error "Invalid Task Result value"....
I am still using SQL 7.0
<code>
Option Explicit
Function Main()
Dim oFSO, oConn, sFileName, oFile
' Get the filename from my Text File connection called "Text File (Source)"
Set oConn = DTSGlobalVariables.Parent.Connections("Connection 1"
sFilename = oConn.DataSource
Set oConn = Nothing
Set oFSO = CreateObject("Scripting.FileSystemObject"
MsgBox sFileName
' Check File Exists first
If Not oFSO.FileExists(sFilename) Then
MsgBox "Failure"
' Return Error
' Main = DTSTaskExecResult_Failure
Else
' Get file object
Set oFile = oFSO.GetFile(sFilename)
MsgBox "Success"
End If
' Set oFile = Nothing
' Set oFSO = Nothing
End Function
</code>
Ideas appreciated.