m.cain

Run gp model within Access 2010

Discussion created by m.cain on Nov 3, 2011
Hello,

I would like to run a geoprocessing model within Access (part of a series of tasks).

As a test, I created a basic command button that called the event procedure shown below (essentially pulled from here: http://support.esri.com/en/knowledgebase/techarticles/detail/31110), however, it crashes and shuts down my database. The very simple test model runs correctly within ArcCatalog 10.

Help?

Private Sub gpModelName_Click()

  Dim pGP As Object

  Set pGP = CreateObject("esriGeoprocessing.GPDispatch.1")

 On Error GoTo EH

 pGP.AddToolbox ("C:\ModelPath\ToolBoxName.tbx")

  pGP.ModelName

  Exit Sub

EH:

  MsgBox pGP.GetMessages(), vbOKOnly, "Error. Please run manually: <b>ModelName</b>"

End Sub

Outcomes