Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

Error Executing DTS package from MSACCESS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Madhuri - 19 Jul 2005 19:10 GMT
Hi all

I am trying to execute a sql server DTS package in MSAccess and the code in
the form goes like this

Private Function RunDTS() As Boolean

On Error GoTo error_

Dim conn As ADODB.Connection
Dim objSproc As ADODB.Command

Set conn = CreateObject("ADODB.Connection")
Set objSproc = CreateObject("ADODB.Command")

'conn.Open "Connection String"

Set conn = AdGcn

With objSproc
   .CommandType = adCmdStoredProc
   .CommandText = "sp_ServiceRequesttoAccess"
   .ActiveConnection = conn
   .Parameters.Append .CreateParameter("@Error", adBoolean, adParamOutput,
1, False)
   .Execute
   If .Parameters("@ERROR") = True Then 'Error in DTS...
       Err.Raise "9967", , "Failed to run DTS package" & vbCrLf & "Call IT
development for assistance"
   Else
       MsgBox "Data transfer Successful"
   End If
End With

Set objSproc = Nothing
Set conn = Nothing
RunDTS = True

exit_:

Exit Function

error_:

Select Case Err.Number
Case Else

   MsgBox Err.Number & " " & Err.Description

 
   RunDTS = False
   Resume exit_
End Select

End Function

The stored procedure goes like this
CREATE PROCEDURE sp_ServiceRequesttoAccess @error bit OUTPUT
AS
DECLARE @shell varchar(255)
SET @shell = 'dtsrun /S PCGOADFILE /N "Kaiser_OCI_ServiceRequesttoAccess"/U
"sa" /P "Password"'
exec @error = master..xp_cmdshell @shell
return @error
GO

I am not able to run the DTS... giving me an error... Please help

Thanks
Madhuri
Chaim - 19 Jul 2005 19:38 GMT
Not sure if this just a typo in the post or the code, but you need a space
between ".....Access" and '/U' in the "SET @shell" line.

Signature

Chaim

> Hi all
>
[quoted text clipped - 66 lines]
> Thanks
> Madhuri
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.