MS Access: Execute SSIS dtsx package from Access vba

I needed to execute dtsx package from Access VBA. After trying few attempts I found that this cannot be done directly. Instead call a bat file which again calls dtsx package or we can say SSIS package. Below is the script to run bat file through Access VBA.
RunFile "D:\test\callpackage1.bat", vbNormalFocus

To execute above script, below function has to be added as well in VBA.
Function RunFile(strFile As String, strWndStyle As String)
On Error GoTo Error_Handler

   Shell "cmd /k """ & strFile & """", strWndStyle

Error_Handler_Exit:
   On Error Resume Next
   Exit Function

Error_Handler:
   MsgBox "MS Access has generated the following error" & vbCrLf & vbCrLf & "Error Number: " & _
   Err.Number & vbCrLf & "Error Source: RunFile" & vbCrLf & "Error Description: " & _
   Err.Description, vbCritical, "An Error has Occured!"
   Resume Error_Handler_Exit
End Function

Suppossing your package name is package1.dtsx, below script has to be mentioned inside bat file.
-@ECHO OFF
"C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTExec.exe" /F "D:\test\package1.dtsx"
echo msgbox "FILE UPLOADED SUCESSFULLY!"

3 comments:

  1. Thank you for mentioning such interesting details. It is only possible to count mouse clicks in this profile Clicker Counter, since there is only one method to do this. It can be useful for tracking clicks.

    ReplyDelete
  2. The tool records every press of your spacebar. Thus, you can calculate how many times you press the space button in a minute. Recently, spacebar hitting competitions started in TikTok. This contest started by some TikTok users is turning into a growing trend.
    Space bar counter

    ReplyDelete
  3. This is a fantastic read—thanks for putting it together. Be sure to check out this article for more information Color Blindness Test Free. Interesting fact: Color tests are used across psychology and marketing.

    ReplyDelete