Run gp model within Access 2010

1205
0
11-03-2011 02:41 PM
MathieuCain
New Contributor III
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
0 Kudos
0 Replies