By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

Running DTS package from Access

P: n/a
I have an Access database that has a few huge tables. It was taking
about 20 minutes per table to import them from another application. I
used the upsize wizard to put them in a SQL server database. I created
a DTS package to import the files and it runs in less than 5 minutes.
I'd like to change my macro that used transfer text to import my files
to run my DTS package. I've seen several posts regarding this, but I
don't understand enough about SQL server stuff to figure out how they
should work.
P.S. I did try to save my package as a Visual Basic file. Then I
tried to create a new module and import the .bas file into it, but I
got a compile error at the beginning of the code:
Public goPackageOld As New DTS.Package
Public goPackage As DTS.Package2
User defined type not defined.
Also I'm not sure how to execute the module (maybe RunCode from another
macro???) from my original macro.
Any help at a VERY BASIC level would be much appreciated.
Thanks

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
The "User defined type not defined" error message results from a missing
reference to the Microsoft DTSPackage Library. You can select this from the
Tools menu, References in the VB Editor window.

You can use the RunCode method to execute a function (as opposed to a
subroutine). My experience is that the package code generated when saving
as Visual Basic creates subroutines (as opposed to functions). Therefore,
you may need to create a function in the module and use this function to
call the Main subroutine in the DTS generated code.

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"kkrizl" <kk****@co.el-dorado.ca.us> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I have an Access database that has a few huge tables. It was taking
about 20 minutes per table to import them from another application. I
used the upsize wizard to put them in a SQL server database. I created
a DTS package to import the files and it runs in less than 5 minutes.
I'd like to change my macro that used transfer text to import my files
to run my DTS package. I've seen several posts regarding this, but I
don't understand enough about SQL server stuff to figure out how they
should work.
P.S. I did try to save my package as a Visual Basic file. Then I
tried to create a new module and import the .bas file into it, but I
got a compile error at the beginning of the code:
Public goPackageOld As New DTS.Package
Public goPackage As DTS.Package2
User defined type not defined.
Also I'm not sure how to execute the module (maybe RunCode from another
macro???) from my original macro.
Any help at a VERY BASIC level would be much appreciated.
Thanks
Nov 13 '05 #2

P: n/a
Selecting the reference, and creating the function to call the Main
subroutine worked perfectly! Thanks!!!

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.