[dba-SQLServer]Execute DTS from VBA

Mark L. Breen subs at solution-providers.ie
Thu Jun 5 03:24:54 CDT 2003


Hello Susan,

Have a look at the following lines of code

            Dim objPackage2 As New DTS.Package
            objPackage2.LoadFromSQLServer ".", , ,
DTSSQLStgFlag_UseTrustedConnection, , , , "NEWSPPSPackage"
            objPackage2.FailOnError = True
            objPackage2.Execute
            objPackage2.UnInitialize
            Set objPackage2 = Nothing


They are taken from a system that I have just finished, they are working.
It is important to use the uninitialize, otherwise, you cannot reuse the
package.

One word of warning, I am sometimes finding that it does not like being used
in quick sucession, but only sometimes, I cannot figure out why if fails
when it does.  Other times, it will import five and ten files rapidly in
quick sucession.

I was considering rewriting the code to manually handle the file that I am
importing on a line by line basis, but I feel that DTS should be the way to
go, otherwise why would MS have created it in the first place.  But then
again, you could say that about the fax facility in Windows 95.

Let me know what you decide to do, I would be interested.

Thanks

Mark Breen
Ireland




----- Original Message ----- 
From: "Susan Geller" <sgeller at cce.umn.edu>
To: <dba-SQLServer at databaseadvisors.com>
Sent: Wednesday, June 04, 2003 2:22 PM
Subject: [dba-SQLServer]Execute DTS from VBA


> Can I execute a DTS from inside my ADP file in code?  How?
>
> Access XP, Windows XP, SQL Server 2000.
>
> Thanks.
>
> --Susan
>
>
> Susan B. Geller
> Office of Information Systems
> College of Continuing Education
> University of Minnesota
> 306 Wesbrook Hall
> 77 Pleasant Street SE
> Minneapolis, MN 55455
> Phone:  612-626-4785
> Fax:  612-625-2568
>
>
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
>
>




More information about the dba-SQLServer mailing list