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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box showing contents of a Directory

Status
Not open for further replies.

ajolson1964

Programmer
Mar 25, 2008
31
US
What I would like to do is have the user be able to select a file located in a directory using a combo or list box. So when the user clicks on the combo box a drop down list appears that lists all the files in a specified directory. Can that be done and if so how would I set it up?
 
Please don't post the same question in two different Access fora: thread705-1466318

Have a look at Application.Filesearch
 
Yes, it is possible....have not done it for a while.

This function is called in form open (or when you need to refresh

Code:
Private Sub UpdateFileAvail()
Dim tmp As String, x As Integer
On Error Resume Next

With FileSearch
    .NewSearch
    .lookin = "<enter pach i.e c:\>"
    .filetype = 1 'msoFileTypeAllFiles
    .FileName = "<can use wildcards to restirct file types>"
    If .Execute > 0 Then 'if there is at least 1 record found
        For x = 1 To .FoundFiles.Count
              tmp = tmp & ";" & Mid(.FoundFiles(x), 25) 'append file name only to string
        Next x
        tmp = Mid(tmp, 2) 'remove leading ;
    End If
End With

Me!UpdateAvail.RowSource = tmp
If UpdateAvail.ListCount > 0 Then
    UpdateAvail(0).Selected = True
End If
End Sub

SeeThru
Synergy Connections Ltd - Telemarketing Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top