Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Help with creating windows directories via access

Author  Topic 

weedavie22
Starting Member

24 Posts

Posted - 2004-02-02 : 06:40:21
I have a system that creates a folder in the C drive to correspond to the file number in my database:

Private Sub Command169_Click()
MkDir "C:\test\" & [File ref] & "\"
End Sub


which would give me c:test\0001
This is okay for individual current form records but what I want to do now is create a button on the main menu of my database that takes every record from the table and creates a directory for them all e.g.

c:test\0001\, c:test\0002\, c:test\0003\, c:test\0004\ and so on…

Any ideas?

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2004-02-02 : 07:01:11
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("select someField from yourTable")
rs.MoveFirst
While Not rs.EOF
MkDir "C:\test\" & rs(0) & "\"
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
Go to Top of Page

weedavie22
Starting Member

24 Posts

Posted - 2004-02-02 : 09:06:50
Fantastic!!!

Cheers for your help mate
Go to Top of Page
   

- Advertisement -