Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Task Result value 1

Status
Not open for further replies.

dswitzer

Technical User
Aug 2, 2002
298
US
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 &quot;Text File (Source)&quot;
Set oConn = DTSGlobalVariables.Parent.Connections(&quot;Connection 1&quot;)
sFilename = oConn.DataSource


Set oConn = Nothing

Set oFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

MsgBox sFileName

' Check File Exists first
If Not oFSO.FileExists(sFilename) Then
MsgBox &quot;Failure&quot;
' Return Error
' Main = DTSTaskExecResult_Failure
Else
' Get file object
Set oFile = oFSO.GetFile(sFilename)
MsgBox &quot;Success&quot;
End If

' Set oFile = Nothing
' Set oFSO = Nothing

End Function

</code>

Ideas appreciated.
 
You need to make sure the proper value is assigned to the MAIN function. I note that the following statement is commented out in your code. Remove the quote.

Main = DTSTaskExecResult_Failure

There is no statement setting the value on success. You need to add the following to the function.

Main = DTSTaskExecResult_Success

If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
I see.......Yep - that does it!

Thanks again Terry.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top