Creating an Open Folder Control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jport
    New Member
    • Aug 2007
    • 1

    Creating an Open Folder Control

    Hi Everyone,

    Am attempting to use MS Access 2000 and ArcGIS to build a comprehensive Land Referencing system, that is orientated to the new and inexperienced user, while also being versatile enough so as it can be used on different projects,

    I know this sounds like a relatively simple bit of code but every time I’ve look around other forums I get lost and confused, my VBA understanding is still rather basic so I apologise if this request sound stupid.

    My question is how I create custom VBA control that allows me to specify a folder in a text field and then be able to browse its contents at the click of an associated button.

    I am familiar with creating a hyperlink field in a table and just displaying the field in a form, but as I am creating a simple user interface, I would prefer to have the user freely able to modify path.

    Cheers for any help.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You'll want to take a look at the filedialog class.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Originally posted by jport
      Hi Everyone,

      Am attempting to use MS Access 2000 and ArcGIS to build a comprehensive Land Referencing system, that is orientated to the new and inexperienced user, while also being versatile enough so as it can be used on different projects,

      I know this sounds like a relatively simple bit of code but every time I’ve look around other forums I get lost and confused, my VBA understanding is still rather basic so I apologise if this request sound stupid.

      My question is how I create custom VBA control that allows me to specify a folder in a text field and then be able to browse its contents at the click of an associated button.

      I am familiar with creating a hyperlink field in a table and just displaying the field in a form, but as I am creating a simple user interface, I would prefer to have the user freely able to modify path.

      Cheers for any help.
      Just subscribing - will return later.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by jport
        Hi Everyone,

        Am attempting to use MS Access 2000 and ArcGIS to build a comprehensive Land Referencing system, that is orientated to the new and inexperienced user, while also being versatile enough so as it can be used on different projects,

        I know this sounds like a relatively simple bit of code but every time I’ve look around other forums I get lost and confused, my VBA understanding is still rather basic so I apologise if this request sound stupid.

        My question is how I create custom VBA control that allows me to specify a folder in a text field and then be able to browse its contents at the click of an associated button.

        I am familiar with creating a hyperlink field in a table and just displaying the field in a form, but as I am creating a simple user interface, I would prefer to have the user freely able to modify path.

        Cheers for any help.

        Before you do anything, set a Reference to the Microsoft Office XX.XX Object Library.

        Assuming a Text Box on your Form named txtFolder and a Command Button next to this Text Box, in the Click() Event of this Command Button, place the following code. This code will enable you to Browse the Folder you specify in [txtFolder], if the Folder doesn't exist, the My Documents Folder will be open:

        [CODE=vb]
        'If nothing is in txtFolder then get out!
        If IsNull(Me![txtFolder]) Then Exit Sub

        Dim varItem As Variant

        With Application.Fil eDialog(msoFile DialogFilePicke r)
        With .Filters
        .Clear
        .Add "All Files", "*.*"
        End With
        .AllowMultiSele ct = False
        .InitialFileNam e = Me![txtFolder]
        .InitialView = msoFileDialogVi ewDetails
        If .Show Then
        'not needed at this point
        For Each varItem In .SelectedItems
        Next varItem
        End If
        End With[/CODE]

        Comment

        Working...