问题
Is it possible to create a directory folder for individual records in Access 2007. For example
tblUser
ID
firstName
surName
When adding a record, would create a folder C:\userdatabase\Surname,firstName,ID
Could see this being useful in situations for example where a large amount of images/files would need to be associated with a record. Access would create and link to a directory for each record.
Thanks in advance for any advice
Noel
回答1:
You can use the VBA MkDir statement to make a directory.
For example if you want to create a folder whose name matches one of your ID values, as a sub folder under the directory where your database is stored, you could use this code:
MkDir CurrentProject.Path & "\" & ID
回答2:
To create the entire directory structure with one command:
link text
回答3:
While these are all interesting answers to the question asked, I have to wonder why the original poster thinks this is necessary. If you're using your database to keep track of the information, it shouldn't really matter where the files are stored.
Of course, if you need to have access to the files from the file system, this can be a way to do it, but in my experience, usually not the most useful way (it segregates the data to too high a degree).
So, I'm basically saying to go back and question whether the design is correct or not. It very well may be, but you should be certain before committing to something like this, which I consider to be unnecessarily convoluted.
来源:https://stackoverflow.com/questions/2586450/create-directory-for-records-in-ms-access-2007