Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Browse for file

Browse for file

Browse for file

I seem to have a bit of a problem.  I am running ms access 2000 and I need to offer a way for the client to browse for a file and store the path into a field in a table.  I have searched Tek-Tips and have found the following.  I dont seem to have the active X for the common dialoge box and the Application.FileDialog doesnt seem to be a valid option.  is there another way?

RE: Browse for file

#1  Be wary of having to rely on controls and tools that may (obviously) not be standard in your environment.  You'll have to distribute and install and maintain all of that.

#2  The FileSearch object is very useful ... but it can really slow things down ... it's not too bad if you can count on them searching in a particular folder for a file that's presumed to exist ...

Check your help file for FILESEARCH OBJECT.  I think the FILESEARCH object is all you need.  It's part of all office products.

Alan J. Volkert
Fleet Services
GE Commercial Finance Capital Solutions
(World's longest company title)
Eden Prairie, MN

RE: Browse for file

I'm with danvlas,

the filedialog wasn't available until the 2002 version, the common dialog provide has it's distribution problems (commonly referred to as "DLL Hell", I think), so the API is probably the most reliable solution for this challenge.


RE: Browse for file

The Open/File dialog method described in the link is available in all Windows versions, regardless of Office being installed or not. It's just Windows API.

FileSearch object may be disabled by turning off Windows Scripting Host and if so, it won't work.


Daniel Vlas
Systems Consultant


RE: Browse for file

not that I use FileSearch much, but isn't that a member of Access.Application? Would you be thinking of methods of FileSystemObject (Scripting Runtime/Windows Script Host)?


RE: Browse for file

thanks for your help guys I have used the code that was on the link Danvlas gave me.  here is my interesting Dilema.  on one form I ask them to show me where the file is.  that info is saved to a table.  on another form that will be used by external clients, I want the client to click on a button and then be prompted to save the file (that was listed in the table) to their local hard drive.  any ideas how I would accomplish this?  

RE: Browse for file

The following function can be called as follows:

strFilename = FindPicture().

It opens a dialog box which lets you select a specific file and returns the Absolute path of the file, which you can then put into your table aa a pointer.

I've left a lot of options in there as comments to demonstrate how this function can be modified or adapted for other purposes.


Public Function FindPicture() As String

    With Application.FileDialog(msoFileDialogFilePicker) 'Grab copy of the Office file dialog (pick files)
    'With Application.FileDialog(msoFileDialogFolderPicker) 'Grab copy of the Office file dialog (pick folders)
        .AllowMultiSelect = False 'Select only one file
        .Title = "Locate picture file" 'Set dialog title
        .ButtonName = "Choose" 'Set the button caption
        '.Filters.Clear 'Make sure the filter list is clear
        'Add 2 filters
            '.Filters.Add "JPEGs", "*.jpg"
            '.Filters.Add "Bitmaps", "*.bmp"
            '.FilterIndex = 2 ' Set the filter index to 2
            '.Filters.Add "All", "*.*"
        'Set initial path
        .InitialFileName = "C:\Documents and Settings\" 'Initial file search location
        'Show files as thumbnails
        '.InitialView = msoFileDialogViewThumbnail
        .InitialView = msoFileDialogViewList
        'Show the dialog and test the return
        If .Show = 0 Then
            'didn't pick a file - exit sub
            Exit Function
        End If
        'Should be only one file name - grab it
        FindPicture = Trim(.SelectedItems(1))  'Full path of picture
        'On Error Resume Next 'Set error trap
    End With

End Function

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close