[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 335
  • Last Modified:

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

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!
1 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
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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: http://access.mvps.org/access/api/api0001.htm

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now