• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 341
  • 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!
0
lthames
Asked:
lthames
1 Solution
 
als315Commented:
You can use sample from Microsoft:
http://support.microsoft.com/kb/824272/en-us
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
            .Clear
            .Add "PDF Documents", "*.pdf"
    End With
    .FilterIndex = 1
    .Show
    If .SelectedItems.Count = 0 Then
         MsgBox "Select file, please", vbOKOnly
         Me.File = ""
    Else
         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
0
 
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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