How can I add a browse to file control in Access 2003

Posted on 2012-09-03
Last Modified: 2012-10-02
I have a table with an input form where I need to be able to browse/select a PDF file on the local network.

I know how to do this in VB6 but have never done much work in Access so I am a little lost on what control or direction to take.

I set the field up as a hyperlink and if I manually input the file path & name, I can double click on the field and it will open the PDF document.

Now I just need to allow the user to browse/select the file instead of having to input it manually.

Thanks for any direction you can give me!
Question by:lthames
    LVL 39

    Accepted Solution

    You can use sample from Microsoft:
    Here is code for pdf files and only one file:
    Private Sub btnBrowse_Click()
    With Application.FileDialog(msoFileDialogFilePicker)
        'setup File Dialog
        .AllowMultiSelect = False
        .InitialView = msoFileDialogViewList
        'add filter for PDF
        With .Filters
                .Add "PDF Documents", "*.pdf"
        End With
        .FilterIndex = 1
        If .SelectedItems.Count = 0 Then
             MsgBox "Select file, please", vbOKOnly
             Me.File = ""
             Me.File = .SelectedItems.Item(1) 'file - field on your form with file name
        End If
    End With
    End Sub

    Open in new window

    You need reference to Microsoft office objects library
    LVL 84
    To add a bit to what als wrote above: There is no control in Access to do this. You must use code, as suggested above, to open the FileDialog.

    Note you can also use API calls for this:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    The first two articles in this short series — Using a Criteria Form to Filter Records ( and Building a Custom Filter ( — discuss in some detail how a form can be…
    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now