Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I hope this is the right forum for this question. I have a program in MS Access that allows users to input varius aspects related to land treatments including the spatial information (point, line, or polygon). As part of the program the user can select a feature (shapefile) and the feature is automatically copied to the correct location, attributes attached, and loaded to a geodatabase. Currently I use the standard file dialog Set fDialog = Application.FileDialog(msoFileDialogFilePicker) to accomplish this but as ESRI moves more towards geodatabases this is no longer an option as you can only select shapefiles (.shp) with the standard file dialog. Selecting geodatabase (.gdb) does not produce the features within the geodatabase. I want to switch over to ArcMaps file dialog (IGxDialog). The code I found (see below) opens the file dialog but then immediately crashes and shuts down Access before I make a selection. Am I missing something, do I need to adjust a setting or work with something like ArcObjects in Python, or why is it crashing my Access program? Help I'm just an ecologist and in way over my head.

Private Sub Test_Click()
    'Set variables
    Dim pGxDialog As IGxDialog
    Dim pFilterCol As IGxObjectFilterCollection
    Dim pCurrentFilter As IGxObjectFilter
    Dim pEnumGx As IEnumGxObject
    Dim GetFile As String

    '  Select Case aFilter
    Set pCurrentFilter = New GxFilterFeatureClasses
    aTitle = "Select Shapefile or Feature"

    Set pGxDialog = New GxDialog
    Set pFilterCol = pGxDialog
    With pFilterCol
        .AddFilter pCurrentFilter, True
    End With
    With pGxDialog
        .Title = aTitle
        .ButtonCaption = "Select"
    End With

    If Not pGxDialog.DoModalOpen(0, pEnumGx) Then
        MsgBox "No selection : Exit", vbCritical
    End If

    GetFile = pEnumGx.Next.FullName
End Sub
share|improve this question
You probably have to check out a license using IAoInitialize – kenbuja Mar 8 '12 at 20:02
I tried to check out the ArcInfo license with this code and while it ran, once the file dialog opened Access again crashed just as before. Am I not checking out the correct license? I apologize I cannot get the code to appear correctly in this comment window. Dim pAoInitialize As IAoInitialize Set pAoInitialize = New AoInitialize Dim licenseStatus As esriLicenseStatus Dim productCode As esriLicenseProductCode productCode = esriLicenseProductCodeArcInfo licenseStatus = pAoInitialize.Initialize(productCode) – user6287 Mar 9 '12 at 16:14
I copied this code directly into Access 2010 and it worked for me. I did have to add references the libraries ESRI.ArcGIS.Catalog and ESRI.ArcGIS.CatalogUI. – Hornbydd Sep 4 '14 at 15:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.