Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


File Browser - Folder content Listing

Posted on 2003-04-01
Medium Priority
Last Modified: 2008-03-10
lo guys..

Just a quick one.. (I hope!)
I'm looking for a way that I can use an access form to browse folder structures then list contents of the folder in say a listbox ?
Is there an activeX I can use for file browsing and is there an easy way to dump the content list into a list box?

Thanx in advance... :)

Question by:LaVey666uk
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 41

Expert Comment

ID: 8245002
You can use the code here to pop up a "browse for folder" dialog:

Alternatively, this will open the standard Windows Open/Save dialog:

The Dir function can also be used to retrieve a folder's contents but I think the above dialogs are probably more effective.

Author Comment

ID: 8248409
I guess I wasnt ver y clear... sorry shanesuebsahakarn,
Wot I mean is I want to be able to fill a listbox with the results of a folder or drive depending on which is selected, and would like this to be dynamic, like when u use windows expoler.. so a mini windows explorer on my form.. that make sense ?

Author Comment

ID: 8251429
In vb u have drivelist and filelist boxs, any way of getting the same funtionality in access ?
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

LVL 41

Expert Comment

ID: 8264095
Unfortunately, Access doesn't contain the drivelist and filelist controls - you would have to use the Dir function or create your own view using the Treeview control, which isn't a trivial task.

If you just want the file names shown in a list box (no icons or expandable subfolders etc) this is *reasonably* straightforwards. Will that be sufficient ?

Author Comment

ID: 8264813
yeah.. I need to be able to select odd files from a folder location, so this would be ideal.
I have trawled numerous sites looking for a solution, but none so far.. and i looked at the treeview control.. and passed on that one :)
LVL 41

Accepted Solution

shanesuebsahakarn earned 380 total points
ID: 8267873
What you can do is something like this - create a list box and create a temp table (say called tblFiles) with a field called FileName, and bind the list box to the temp table. Then, in the OnOpen event of the form, you can have code like this:

Dim strFile As String

CurrentDb.Execute "DELETE * FROM tblFiles"
strFile = Dir("C:\MyFolder\*.*") 'Change this to your own path
While strFile <> ""
   CurrentDb.Execute "INSERT INTO tblFiles (FileName) VALUES ('" & strFile & "')"

That should give you a file listing for that folder in your list box.

Author Comment

ID: 8267940
nice1 m8.. will trottle off and give it a bash :)

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question