"The task reported failure on execution", SUCCESS precedence fails. WHY?

-- strFolderName successfully retrieves a number from a field in a table.  That field is a varchar field.  The data is always a number and I need to return "SUCCESS" if the number is lower than 998 or "FAILURE" is that number is not.
I have this code in an Active Script Task in a DTS package.  The task runs successfully and since at this point the number IS under 998 failure 'precedence' is not called.  The success 'precedence' is called but fails with the "The task reported failure on execution" error.
Can anyone help me out with this please?  I don't understand what this error means since the task does run successfully.  Or is there an error in my code?

	SECTION_NAME = 'Refresh' AND KEY_NAME = 'NextDataFileGroup'"
	Recordset.Open strSQL, Conn
	Do While NOT Recordset.EOF
		strFolderName = Recordset("KEY_NAME_VALUE")
	Set Recordset=Nothing
	Set Conn=Nothing
	If cInt(strFolderName) < 998 Then
		Main = DTSTaskExecResult_Success
	End If
End Function

Open in new window

Who is Participating?
imanymConnect With a Mentor Author Commented:
OK, it looks like it works now.
I though that the "The task reported failure on execution" message was an error, but looks like it is just what the task reports when it is supposed to report the FAILURE.  It looks like the task crashes, but that's just the look of it when it reports failure.  I am not very familiar with VB Sript and that is why I was confused.
Thank you very much for your help!!!
Anthony PerkinsCommented:
Well for one you are not explicitly setting the DTSTaskExecResult_Failure, but I suspect the problem is elsewhere.  You need to post your DTS diagram here so that we can get a better understanding of what you are trying to accomplish.
imanymAuthor Commented:
This is my DTS diagram
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Anthony PerkinsCommented:
Ok.  I think I understand now what you are trying to achieve and yes you are right if strFolderName < 998 there has to be an error in your code.  What I would suggest you do is enable "Turn on just-in-time debugging" (right click on the Data Transformation Services and select Properties) and add appropriate Stop statements to narrow down the problem.  Alternatively, add a few MsgBox's to narrow down the problem.

If all else fails, post the entire code from your ActiveX Script Task.

You should also know that there may be better ways of skining this cat, but let's get to the bottom of this first.
imanymAuthor Commented:
Thanks very much for helping me out on this.
I turned on the debugging, activeX script still executes successfully without any errors.
The SMTP task gets called on succes, but fails on execution.
Anthony PerkinsCommented:
>>I turned on the debugging, activeX script still executes successfully without any errors.<<
Did you add a Stop and step through it to make sure it executes correctly?

>>The SMTP task gets called on succes, but fails on execution.<<
Have you tried executing that task on its own?  Perhap it is a problem with that task and how you have email setup.
imanymAuthor Commented:
Did try that, executes successfully.
Anthony PerkinsCommented:
>>Solved the problem myself, looks like.<<
Yeah, right. Whatever.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.