Want to be able to file browse in access form

  • Thread starter Thread starter Jason Willis
  • Start date Start date
J

Jason Willis

I want to be able to return a file name and path by using
a standard windows file browser in access.

Is there some thing standard in access or do I have to
find an addin or something???

Thanks
 
Hi,

If you are using Access 2002 or 2003 then the following code would open the
file dialog:

Dim fd As FileDialog
Dim varSelectedItem As Variant
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.AllowMultiSelect = False
.Title = "Please select a file..."
.ButtonName = "&Select"
If .Show Then
For Each varSelectedItem In .SelectedItems 'Only once in this
case
MsgBox "File selected " & varSelectedItem, vbInformation,
"FileDialog"
Next
Else
MsgBox "Cancelled by user", vbInformation, "FileDialog"
End If
End With
Set fd = Nothing

For this to work you will need have a reference set to the Microsoft Office
Object Library.

HTH

--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/
 
Jason,

The code found at the Access Web:

http://www.mvps.org/access/api/api0001.htm

is nearly always recommended in these newsgroups as the "way to go" for the
purpose you cite. The code includes a TestIt() function which will show you
exactly how to use it to return a path and filename.

hth,
 
Back
Top