Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a DTS and displaying when it went wrong

Status
Not open for further replies.

flaviooooo

Programmer
Feb 24, 2003
496
FR
Hi,

I'm trying to import a text-file into an Access ADP. For this I use a DTS package, which works fine.

Now i'm trying to trigger this DTS package from my Access-form. I have not found anyway better than creating a job that runs this DTS Package, and subsequently creating a stored procedure that runs the job.

Is there a better way to run the DTS than this?

Anyway, if I would leave it like this with the running of the stored procedure: Is there a way to get some kind of errormessage if the job went wrong? When I run the code now and it fails, it doesn't tell me anything...

Any advice?

The code is as follows:

Code:
 Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset
Dim param1 As Parameter, param2 As Parameter, param3 As Parameter, param4 As Parameter

' Connect
Set cnn = CurrentProject.Connection

Set cmd.ActiveConnection = cnn
' Set up a command object for the stored procedure.
cmd.CommandText = "sp_Import_Stock_Slough"
cmd.CommandType = adCmdStoredProc

' Execute command and return results to recordset

Set rst = cmd.Execute

Thanks in advance

Kind regards
Fabian
 
Hey pwise, thanks for the response.

I tested it now with @@error, but unfortunately it keeps giving me 0 as result.

I think this is due to the fact that he successfully launched the job. It is the job itself that fails...

Even better would be if I could run the DTS directly from the code, but is this possible?

Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top