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 GetFile = pEnumGx.Next.FullName End Sub