Searching for files on a drive

Hemish

Registered User.
Local time
Today, 21:03
Joined
Jan 20, 2005
Messages
65
Hi,

Just wondering, i'm using Ms Access 2000 and i need to search a drive on my computer eg T: drive and look for all *.jpg and put the name of the file in a table.

Do you know how to write this in code please?

Thank you in advance
 
Look at: Application.FileSearch

There are plenty of copy and paste example on google.
 
Not that I know, cause I've never gotten to like that FileSearch thingie, but I thought it was implemented first in the xp/2002 version (and, fortunately, removed in the 2007 version).

One place with a bit of code, comparision etc, is Douglas Steeles article http://advisor.com/doc/16279, then there's also Allen Brownes article http://allenbrowne.com/ser-59.html (note - for this to feed a listbox, you'd need xp/2002)

For the latter one to write text to table, you could replace the line

Debug.Print varItem

with

db.execute "INSERT INTO myTable (myFieldName) VALUES (""" & varItem & """)", dbFailOnError

This would require the lines

Dim db as dao.database
set db = currentdb

at the top of the routine.
 
Thanks for you link and the tip i will try it out
 

Users who are viewing this thread

Back
Top Bottom