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

inserting file names into an access table

Status
Not open for further replies.

MarieMetcalf

Technical User
Mar 28, 2002
5
US
I am creating a database to organize a large number of jpeg files. I don't want to store the jpegs in access, just the name and location of each. Is there a way to import the names of the files from the directory into an excel spreadsheet, a text file or directly into an access table without having to key each one? If not, is there any software that will do this task?
Thanks, Marie %-)
 
You can use the file scripting object to read the directory structure and put the file names in an access table or whereever you want. Here is an example to get you started. You will need to set a reference to the scripting runtime library.

EXAMPLE
Function ReadDirectory()
'-- Microsoft Scripting Runtime Library needed.

''-- Define some FSO objects
Dim objFSO As Object
Dim objFile As File
Dim objFileitem As Variant
Dim objFolder As Folder
Dim objSubFolder As Folders
Dim objFolderContents As Variant
Dim objFolderItem As Variant

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("c:\edi")

Set objFolderContents = objFolder.Files

For Each objFileitem In objFolderContents
Debug.Print objFileitem.Name
Next

Set objSubFolder = objFolder.SubFolders

For Each objFolderItem In objSubFolder
Debug.Print " "; objFolderItem.Name
Next

End Function

 
Assuming you are same person that e mailed me about a photobase I will send it shortly.

I also have a Word document that gets every filename in a folder so I will send that as well

Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Thanks to cmmrfrds and nberryman for the rapid response.
I found a freeware utility on that puts the contents of a directory in a text file that can be loaded into an excell spreadsheet. I can import this into an access table. The utility is called Directory Lister written by Leszek Skorczynski.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top