January 15, 2015 at 10:38 am
I might not be posting in the correct forum, and I apologize in advance if that is the case.
I have inherited a program someone else built - and they are no longer around. The thing has been working for 1.5 years until today suddenly there's an error.
Here is what the error says:
Error Code:0
Error Source= Microsoft VBScript Runtime Error
Error Description: Type Mismatch: 'CInt'
Error on line 20
Here is the script - I don't know enough to even look at line 20 and find the error!?!? Please HELP!
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Option Explicit
Function Main()
Dim oPkg, oTasks, oSendMailTask, oRecipient, oLocation
' Get Package object
Set oPkg = DTSGlobalVariables.Parent
' Get Tasks collection
Set oTasks = oPkg.Tasks
' Get DTS Send Mail Task by Name
Set oSendMailTask = oTasks("DTSTask_DTSSendMailTask_1").CustomTask
' Set oLocation value
oLocation = CInt(DTSGlobalVariables("Location").Value)
' Set Subject to the Package Name
oSendMailTask.Subject = "Benefits Billing Extract for Reporting Location " & oLocation
' Set the attachement to the file of the named connection
oSendMailTask.FileAttachments = DTSGlobalVariables("Location_FileName").Value
' Set Message Recipient
Select Case oLocation
Case 102
oSendMailTask.ToLine = "jonesj2"
oSendMailTask.CCLine = ""
Case Else
oSendMailTask.ToLine = "PSCBenefits@pscnow.com"
oSendMailTask.CCLine = ""
End Select
' Clean Up
Set oSendMailTask = Nothing
Set oTasks = Nothing
Set oPkg = Nothing
Main = DTSTaskExecResult_Success
End Function
January 15, 2015 at 11:37 am
Is this in a script component in an old DTS package?
But that's a VB Script error it looks like on this line,
oLocation = CInt(DTSGlobalVariables("Location").Value)
Which is converting whatever is in DTSGlobalVariables("Location").Value to an integer, it could either be out of range(you can try changing the CInt to a CLng) or if that's a character string it's just not able to convert it.
January 16, 2015 at 8:08 am
Hi There,
Thanks so much for the response! I wish I knew enough about anything to know what you are talking about. LOL!
Yes, I believe this is a part of a DTS Package. I log into Enterprise Manager, then go to Data Transformation, then Local Packages.
As for the line error - I change it to 'CLng' - and get the exact same error.
Can someone help!? I can even user TeamViewer to remotely connect you to my screen so you can see what's happening.
Thoughts?
-Shane
January 16, 2015 at 10:24 am
Then that error is because whatever value is being set in that global can't be converted to a number.
Looking at the script it looks like all he's doing is converting it to a number then appending it to a string(which will just convert it back to a string) Without knowing the business rules it's hard to offer a suggestion but you can try changing this
' Set Subject to the Package Name
oSendMailTask.Subject = "Benefits Billing Extract for Reporting Location " & oLocation
to this
' Set Subject to the Package Name
oSendMailTask.Subject = "Benefits Billing Extract for Reporting Location " & DTSGlobalVariables("Location").Value
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply