What query do I use to list the contents of a directory?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to list the contents and attributes of a folder using MS Access. How
can this be done?
 
I appreciate the suggestion...I am still a little behind I guess. I tried to
write a function that i could call from a query, but that did not work. can
you expand on your suggestion a little? I basically want to pull back a list
of the contents of a directory and populate a table. I would like to pick up
the attributes also (modified date, etc.)
 
Oh, we are in the query group, aren't we.
It will not work by itself in a query. You can use a query in a function,
but you have to be aware of the behaviour. If you use a function in a query
and don't pass it field in the query, the query will only execute one time.
To get the query to execute for each line, you have to pass a field. This
doesn't mean the function has to use it, it just means it will cause it to
exeute for each row. You could write your own function that calls the Dir
function, but it has some behaviour that will make it tricky to deal with.
 
I didn't think you could query the contents of a directory directly
from within Access. I mean, I know you can if you use APIs (like the
FileOpenSave function at AccessWeb), but don't you have to write them
to a table somewhere? Maybe you can do it with ADO, since it can read
all kinds of type of data... <shrug> Only way I know how to do it is
to use DIR and write the results to a table... but I'm a mental midget,
so take that with a few grains of salt.
 
Back
Top