Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Browse window from an Access form.

Status
Not open for further replies.

bigdavidt

Programmer
Feb 12, 2004
52
US
I want to create a button that a user would click on, to open up a browse window for searching though the hard drive or network drives to locate a file. After selecting the file and clicking on an OK button this process would return the full path and file name to Access and be stored on my form.

I have done this in VB.NET but not in Access.
 
I think I got this from PHV, over here at Tek-Tips; (slightly modified)

Public Function OpenFileDialog() As Variant
'Opens File Dialog
Dim FileDialog As FileDialog
Dim vFileSelected As Variant, x As Integer

Set FileDialog = Application.FileDialog(msoFileDialogOpen)

If FileDialog.Show = -1 Then
For Each vFileSelected In FileDialog.SelectedItems
OpenFileDialog = OpenFileDialog & ";" & vFileSelected
x = x + 1
Next vFileSelected
Else
MsgBox "nutin' selected,bro?"
End If

Set FileDialog = Nothing
OpenFileDialog = Mid(OpenFileDialog, 2)

End Function
 
Hello bigdavidt

Check this link out.


The first 2 items on the page are what your interested in.

The 1st choice tells you how to select a file, the 2nd shows how to select a folder.

Bookmark the site.... They have great samples!
Hope this helps.

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top