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!

Create directory with field value as name...

Status
Not open for further replies.
May 9, 2000
446
GB
Hi, I have a database that holds data relating to various years. I need to create a directory for each year on the hard disk so that files can be put there.

So i have a query that groups all of the years held on the database now how do i use on onTimer event to look at all of the years, check if a directory called 2001 (for example) exists and then create it if it doesn't? The bit i really don't know how to do is the looping through the query recordset records if its possible.....
Cheers
 
I assume you all the directories youll be setting up are in the same directory so here goes

Do while not rs.eof

filename = dir(pathname & rs!Year)
if len(filename) = 0 then
mkdir(pathname & rs!Year)
end if
rs.movenext
Loop

Hope this helps somewhat.

Mark
 
Spellman cheers for the reponse but could you expand a bit? I don't know how to get the value from the query into the module, i've not tried this type of thing before
Cheers

Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top