Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
share|improve this question
1  
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
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.