dbTalk Databases Forums  

activex script to supply access file

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss activex script to supply access file in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dk
 
Posts: n/a

Default activex script to supply access file - 04-12-2004 , 06:12 PM






a dts package tries to use an activex script
to change the file name of a connection
to an access database. The activex script
fails. this is the script - any idea what is wrong?

Function Main()

Dim objFSO, strFullNm
Set objFSO = CreateObject
("Scripting.FileSystemObject")

strFullNm = DTSGlobalVariables("MDB
Filename").Value

if objFSO.FileExists(strFullNm) Then
MsgBox strFullNm + "Exists"

Dim oConn

Set oConn =
DTSGlobalVariables.Parent.Connections
("Reconciliation_History")
oConn.DataSource = DTSGlobalVariables("MDB
Filename").Value

Set oConn = Nothing


Main = DTSTaskExecResult_Success
else
MsgBox strFullNm + "Nope"
Main = DTSStepScriptResult_Failure
end if

Set objFSO = nothing


End Function


tia,
dk

Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: activex script to supply access file - 04-12-2004 , 11:32 PM






Other than having to change the not exists execution result
to:
Main = DTSTaskExecResult_Failure
it runs fine on my end. So if you are sure you are pointing
to a valid path to an Access database, you should check the
Global Variable name and how you are setting this value. You
could just add a MsgBox strFullNm to see what it is after
you set the variable.
You'd also want to make sure your Access connection is named
Reconcilliation_History.

-Sue

On Mon, 12 Apr 2004 16:12:17 -0700, "dk"
<anonymous (AT) discussions (DOT) microsoft.com> wrote:

Quote:
a dts package tries to use an activex script
to change the file name of a connection
to an access database. The activex script
fails. this is the script - any idea what is wrong?

Function Main()

Dim objFSO, strFullNm
Set objFSO = CreateObject
("Scripting.FileSystemObject")

strFullNm = DTSGlobalVariables("MDB
Filename").Value

if objFSO.FileExists(strFullNm) Then
MsgBox strFullNm + "Exists"

Dim oConn

Set oConn =
DTSGlobalVariables.Parent.Connections
("Reconciliation_History")
oConn.DataSource = DTSGlobalVariables("MDB
Filename").Value

Set oConn = Nothing


Main = DTSTaskExecResult_Success
else
MsgBox strFullNm + "Nope"
Main = DTSStepScriptResult_Failure
end if

Set objFSO = nothing


End Function


tia,
dk


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.