Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 problem w/ activex script in DTS package

Author  Topic 

raritan
Starting Member

39 Posts

Posted - 2007-08-15 : 17:36:19
I have a DTS package set up with some code in an activex script that sets some global variables in my package. The package runs fine from my computer. But when someone else goes to enterprise manager from their computer and executes the package, it errors out on the step where the script it run and says there is a run-time error. Why is this happening just on that machine, and how can I de-bug while running it on that machine to see why it's erroring out, on what line of code? Here is the code:

Function Main()
Set OpenFileDialog = CreateObject("MSComDlg.CommonDialog")
With OpenFileDialog
.DialogTitle = "Select Data Source"
.Filter = "All Files|*.*"
.FilterIndex = 4
.MaxFileSize = 1024
.InitDir = "S:\NBC\MCI\CDRs\"
.ShowOpen
End With
MyStr = OpenFileDialog.FileName
MyChrPos = InStrRev(MyStr, "\")
MyStrLen = Len(MyStr)
MyFileName = Mid(MyStr, (MyChrPos + 1), (MyStrLen - MyChrPos))
MyEndFileName = Right(MyStr, 31)
Select Case Left(MyEndFileName, 8)
Case "01002246"
MyCarrierName = "MCI"
Case Else
MyCarrierName = InputBox("This filename does not begins with '01002246'. Enter Name of Carrier (Qwest or MCI):", "Carrier Name" )
End Select
MyEMRFileName = InputBox("Enter EMR filename:", "EMR File For Billing" )
DTSGlobalVariables("gVarData_Source").Value = MyStr
DTSGlobalVariables("gVarImport_File").Value = MyFileName
DTSGlobalVariables("gVarEMR_File").Value = MyEMRFileName
DTSGlobalVariables("gVarCarrier_Name").Value = MyCarrierName
Main = DTSTaskExecResult_Success
End Function

Thanks for your help,
Kevin

raritan
Starting Member

39 Posts

Posted - 2007-08-16 : 10:32:07
ok I see now that I needed to turn on the just-in-time debugging in enterprise manager, which I have done. Now I believe I have to put a STOP statement in my code in order for the debugger to work when it finds a runtime error. Where do I need to place the statement and what is the syntax?

Thank you
Kevin
Go to Top of Page

Stevan2020
Starting Member

25 Posts

Posted - 2007-08-16 : 10:56:46
You can use a messagebox to write variables to the screen

if sDebug = "1" then
MsgBox(" Running in Debug mode")
end if

...code...

MyChrPos = InStrRev(MyStr, "\")

if sDebug = "1" then
MsgBox(MyChrPos )
end if

-- Steve
Go to Top of Page

raritan
Starting Member

39 Posts

Posted - 2007-08-16 : 11:46:24
that's fine, but will this open the script debugger and allow me to see which line of code is erroring out, and will it tell me the name of the run-time error? that's what I really need to know.

Thanks,
Kevin
Go to Top of Page

raritan
Starting Member

39 Posts

Posted - 2007-08-20 : 09:06:04
bump
Go to Top of Page
   

- Advertisement -