Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2003
    Posts
    21

    Unanswered: Browse Hard Drive in MS Access Form

    I am building a MS Access form. In one of the fields, I want the user to specify a file on the hard drive, to be used later. How do I set the field up to allow the user to browse through the folders of the hard drive, and select the desired file, so that the complete path name appears in the field, without the need for the user to type in the entire path name?

    [In other words, I wish to implement in MS Access the equivalent of an input type=file in html.]

    I have seen Ken Getz's solution (http://www.mvps.org/access/api/api0001.htm), but, as I am a novice in MS Access, I don't know how to use it. Also, I wonder if it provides more functionality than I need. (I don't need the ability to open/save, just select a file.)

    Since I am a novice in MS Access, solutions which are more detailed and assume very little will be most helpful. Thank you.

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    Code:
    Private sub Button1_Click()
      Dim openFile As Object
      Set openFile = CreateObject("MSComDlg.CommonDialog")
      openFile.initDir = "C:\"  ' Initial Directory
      openFile.ShowOpen
      MsgBox openFile.FileName
    End Sub
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Apr 2003
    Posts
    21
    Thank you so much, r123456!

  4. #4
    Join Date
    Mar 2004
    Posts
    41
    I get an error on the MSComDlg.CommonDialog. Is there a reference required?

  5. #5
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    Here is an Example using the API functions
    Attached Files Attached Files

  6. #6
    Join Date
    Mar 2004
    Posts
    41
    For anyone who could use it...
    This is a single form which allows you to browse your PC/network and display a list of users currently in a particular mdb.
    Credit goes to hammbakka for the majority of the code.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •